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.
lens=len(s) and replace it -- this will improve it quite a bit.
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.
I believe this algorithm has close to optimal performance in terms of speed and memory.
This kata should be revised and explained clearly. Otherwise, a lot of people will waste a lot of time.
This test is so bad. It doesn't say clearly how to deal with punctuation, and the "correct" solution ignore all words attached with any punctuation, and it just doesn't make sense. Don't waste a lot of time here because finally the "correct" answers are wrong.
Go try to pig_it the following string: "Hi~ Guys@Codewars:\nThat's a so-called 'pig-latin way', isn't it?!"
If you run the "correct" code, you will get this result. It just doesn't make sense.
Hi~ Guys@Codewars: That's aay so-called 'pig-latin way', isn't it?!
This test is so bad. It doesn't say clearly how to deal with punctuation.
I couldn't get to the right answer until I used very naive method to split. Any word that's attached to a punctuation will not be translated.
Go try to pig_it the following string. "Hi~ Guys@Codewars:\nThat's a so-called 'pig-latin way', isn't it?!"
If you run the "correct" code, you will get this result. It just doesn't make sense.
Hi~ Guys@Codewars: That's aay so-called 'pig-latin way', isn't it?!
This comment is hidden because it contains spoiler information about the solution