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.
My point is that this solution is
O(2^n)
too, so your point is invalid.That is exactly my point initially, not sure why are you arguing.
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:
Python can crush with an error using recursion on bigger values. This one would at least work.
My solution has linear time and constant memory complexity (although it may not look pretty as some one-liners on this site). I think it's the best we can do here.
This comment is hidden because it contains spoiler information about the solution
Nope, it's still the same as the recursive ones. It'll still timeout badly for long strings.
Nope, it's still the same as the recursive ones. It'll still timeout badly for long strings.
This should be voted as Best Practice!
Yes, thinking about performance, linking external modules for simple task may not be a good practice.
Yes you should because this solution uses reqursion and it will fail on large matrices.
This is so disapointing.
The bug was reprted over one year ago and it's still not fixed.
The worst kata ever.
You probably try to print result instead of returning it
You probably try to print result instead of returning it