The part we need to concern ourselves with in regards to circular arrays is the expectation that each element will not only look to the end, but also require checking against the numbers prior to it as well.
To solve for that, there are a few approaches. Press Next to see what they are!
xxxxxxxxxx17
var assert = require('assert');function nextLargerNumber(nums) { // implement this function return nums;}try { assert.deepEqual(nextLargerNumber([3, 1, 3, 4]), [4, 3, 4, -1]); console.log( 'PASSED: assert.deepEqual(nextLargerNumber([3, 1, 3, 4]), [4, 3, 4, -1])' );} catch (err) { console.log(err);}OUTPUT
Results will appear here.