Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
.
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.)
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".
Thanks! I thought it was my fault
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)