Ad
  • Custom User Avatar
  • Custom User Avatar

    Well, that's effectively a critic point, here. If you carefully look at the sample tests, you'll see ("have seen"?) that you're effectively solving several tests with the same grid instance. So if you mutate the input, that could lead to troubles, yes. Though... Actually... In the present case... If you think hard about it, you'll see that you still can avoid the deepcopy operation.

    (note about deepcopy: generally, this modle is VERY slow, so if you're in critical need of performances, you should implement your own copying. But that's more a general note than a hint for this kata: the structure being quite simple, you won't gain much with that, here.)

  • Custom User Avatar

    basically, your approach is good. I think you should check that you store the data in an efficient manner, then verify that you do not explore branches where you actually already know that there won"t be any match. Be sure you don't any any useless O(n) check or archiving that should be O(1): that especially would be the "death of your code".

  • Default User Avatar

    Thanks! I thought it was my fault

  • Custom User Avatar

    Thanks for your feedback.
    It seems that finally you solved it.
    C++ version is a translation from @Dentzil, I don't know C++ ;-)
    Please tell me if really something is wrong in C++ version(I copied your code and run, it passed all tests)