Ad
  • Custom User Avatar

    Your solution crashes for large numbers. Try running it with n=160000.

  • Custom User Avatar

    If you have execution timeout, then the solution does not pass, despite of returning correct answers.

    See if this paragraph helps.

  • Custom User Avatar

    Object.keys doesn't work on an iterable object ( well, it does, but it doesn't do what you want it to do ). You have to iterate it. Follow the link in the description and read up on the protocol.

    This question was already answered here.

  • Custom User Avatar
                   v                           v   v
    expected [ 9, +0, 9, 1, 2, 1, 1, 3, 1, 9, +0, +0, 9, +0, +0, +0, +0, +0, +0, +0 ] to deeply equal 
             [ 9, 9, 1, 2, 1, 1, 3, 1, 9, 9, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0 ]
    

    The first value there is your answer, and you can see there are more than one 0 not at the end. Probably you're mutating the array at the same time you run through it, skipping values.

    About what +0 is, you can see that's 0, don't mind the + before it, it's probably chai adding it in the assertion.

  • Custom User Avatar

    no, it returns with commas

  • Custom User Avatar

    There is a trick to do it, which doesnt require searching for every possible combination. Hint: think about why its specifically powers of 2?