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.
What bug?
MMMAAANNN's two line solution does l=248 in 1 millisecond but any higher causes maximum recursion error.
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
My point is that this solution is
O(2^n)
too, so your point is invalid.That's because the random tests are woefully weak: only 20 chars max.
Why not try it yourself? ;-) Like this:
This test obliterates most existing solution easily. If not, increase
l
to100
or something.And your solution fails on this case:
Nope, it's still the same as the recursive ones. It'll still timeout badly for long strings.