Ad
  • Custom User Avatar

    Instructions aren't clear, probably because neither example looks like it's using one's or two's compliment. How is +6 equal to '11010'? Shouldn't it be '110' or '0110'?
    Though, -6 being equal to'1110' makes sense if you're using one's compliment.

    What does 1 and -1 look like? What does 2 and -2 look like? What does 3 and -3 look like?

    Nevermind...negative base number systems. Missed that info.

  • Custom User Avatar

    Solution was to change !value to typeof value === 'undefined'.

    When an element was 0, it was exiting the fn prematurely.

  • Custom User Avatar

    myjinxin2015, How are you formatting code in the comments?

  • Custom User Avatar

    Thanks for all the help! Your question about !value is for the case there's only one element in the original array.
    Since, as you've correctly pointed out, sorted.shift() changes the array length, value will be undefined so this allows the function to exit with the correct value.

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar

    It's odd, I keep getting different results for the submit tests. Sometimes I get 1 fail, sometimes 9 fails, sometimes 4 fails. But the tests I've written are consistent. And since there's no output for the tests other than 'failed' I cannot figure out WHY those tests fail.

    Are you sure the tests that are being generated are correct?