Ad
  • Custom User Avatar

    You need to find a solution that involves swapping digits around. I cannot read your code because I do not know enough, but I tried both methods of:

    1. adding 1 to the number until it had the same digits
    2. finding all possible combinations of an int's digits, sorting them, and returning ([the index of the original number] + 1)

    both methods were too slow, and would time out.

    the key is logically swapping digits around.

  • Custom User Avatar

    Should be same result, but wouldn't it be slightly faster to shortcut the extra operation?

  • Custom User Avatar

    On second thought, keep it as is. In this case, there's no reason to overcomplicate things. The four arguments are probably more readable for a begginer.

  • Custom User Avatar

    I was just focusing on 8 kyu, it will be quite difficult for them to combine the concept of an array and a variable, but thanks for the idea, if it turns out that beginners know this, then I'll probably add it ) ( in any case, using a loop there will be no way to solve the kata more quickly, no matter how sad it is :( )

  • Custom User Avatar

    I'd say using a 'tuple' would be better. But I agree that having two vectors is better than four coordinates

  • Custom User Avatar

    Yes, but the tests that the author coded are requesting a return zero from a list with two itens, despite this is not explained in the details session.