Your code doesn't return the right answer, tests are fine and this is not a kata issue. If you get another result with the same code elsewhere, it's probably because a different version of the language is used. sort (not stable in Node 10) may be the cause.
This is very delightful. As minimalist as possible.
The Kata has been solved more than 22k times, but it starts to fail only on your attempts :D
Your code doesn't return the right answer, tests are fine and this is not a kata issue. If you get another result with the same code elsewhere, it's probably because a different version of the language is used.
sort
(not stable in Node 10) may be the cause.This comment is hidden because it contains spoiler information about the solution
I am 100% certain, the kata has errors:
Here is proof:
Examples 1:
It should work for random inputs too: expected 823 to equal 328.
823's next biggest is 832.
And if the kata means 328, then 382 is the next biggest.
Both ways wrong.
Example 2:
It should work for random inputs too: expected 87050867 to equal 87050768
87050867's next biggest is 87050876.
And if the kata means 87050768, then 87050786 as the next biggest.
Both are wrong.
Your solution takes ages for n=1234567890.
Your code being too slow is not a kata issue.
Same!
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution