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.
(Yeah, now I'm thinking of it, there seems to be an obvious way to make the code more efficient: I'm gonna try it :) )
EDIT: LOL: in fact, it wasn't even necessary to do try the "complex/subtle/far-fetched" thing: I simply did the "little stpd trick" that had previously come to my mind, but which I had rejected thinking "nah this would be too stpd xD" ==> but that thing actually worked (to my biggest surprise)
RE-EDIT: Now I'm seeing the solutions: I probably should have done the "subtle trick" rather than the "barbaric one" I used...
==> The highest rated solutions use that "trick" I had though of, but was too lazy to implement (as the "barbaric trick" just worked)...
But apparently, "something" must have changed since the creation of this Kata: surprisingly, it seems like most submitted solutions simply consist in the "obvious algorithm" with "no trick at all", and apparently, they didn't experience "Time Out"...
Same thing here; passes the sample tests, but when I want to "submit", it "times out"...
...On the other hand, I must admit I coded it "in a rush" and in the most "obvious/naive/straightforward" way (I was even surprised to see that my "very first attempt" immediatly passed the sample tests); so there might possibly be a way to "make the code more efficient"...
(It seems quite likely, as the "issue" seems to have been reported many times; and while those people's code is hidden, the replies state that tey weren't "efficient enough", so...)
My code pass the first test, but in the second one it gives me passed out time. It might be that my code is not doing the solution in a proper way, but I also think that maybe the test cases are wrong.