Ad
  • Custom User Avatar

    Genralized tip:

    def kata_solution(arg):
        print(arg)
    

    You'll fail all the test, but usually you'll see the input. (Except, as you'll discover here, not always.)

    def kata_solution(arg):
      pass
    

    Often this will help you find out the count of tests. (Although, again not always.)

    I was able to reach 65 tests, but still timed out. I suspect we're using the same algorithm (but I've optimized mine as much as possible). I have in mind another algorithm which I think may be faster, but don't have time to implement it at the moment. I'd encourage you to try a different approach. 232 people have solved it in Python, so it should be doable.

    No spoilers, sorry. :)

  • Custom User Avatar

    Also, you might wanna search it up on wikipedia, if you don't succeed yourself. There's a nuance that could potentially not let you pass.

  • Custom User Avatar

    O(n*sqrt(n)*m) per entire test suite, where m is the number of tests isn't supposed to pass. Gotta reduce this somehow. Remember about the upper bound.