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.
Better constant time factor or caching maybe?
Elegant solve. Thanks for the commented version -- most insightful.
This comment is hidden because it contains spoiler information about the solution
Still a pure function because in order for it to be impure , it would have to access variables OUTSIDE of the function call...this function would always output the exact same thing if given the same input because there is no outside state effecting what happens inside the function...
not really, what if you have a program of O(1)?
(a.pop()|0) + (b.pop()|0)
works (same effect as doing~~
)Although you can compress a range, the enumeration is faster.
Run it through the naive implementation, get back to me when that has come up with an answer ..
it would, since most of the solutions to yours are actually solutions to a "ludicrous" one
Good for you.
It's extreme compared to the naive implementation. This is the performance version, not the ludicrous version. ( I had to be able to solve it myself. )
You're free to compose an extreme performance kata of your own. Maybe it'll get shot down as a duplicate, maybe it won't.
Thank you, you are right:)
This comment is hidden because it contains spoiler information about the solution
It's unnecessarily complciated, inefficient in recurrsion, O(n**2), and memory. For example, if you try this,
longest_palindrome("a"*100000+"b"*100000)
it wouldn't run.
But if you try my solution (and many others similar linear solution), it'll come out in a fraction of a second.
You can always make your solution faster ;)
may i know why is that?
Loading more items...