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.
This solution is forcing lowercase to account for the case-insensitive constraint. Also, your solution is being redundant by checking for a bool value to return a bool value.
I'm stupid xD
that is not a palindrome
cool!thinking from the concept of palindrome
This fails if s = "A man, a plan, a canal – Panama". This should be part of the acceptance.
This solution is O(N) in time. The "in-place" solution you are mentioning is O(N/2) which boils down to O(N) too, since 1/2 is just a constant factor.
The true difference between them lies in their space complexities. This one is O(N) in space, although it is simply mutating the input. But the "in-place" is O(1) in space because it does not use any auxiliary memory.
I still prefer this solution though, as you only need to user lower() once and it is very readable overall. Also, memory has become extremely cheap nowadays and it shouldn't be that much of a problem.
But this is not optimal solution in terms of BigO.
There is better "in-place" solution
this solution gives errors for special characters.
Palindrome: "es una palabra o frase que se lee igual en un sentido que en otro". Ejemplo : "A luna ese anula". Por tanto este codigo no es correcto para casos en que las palabras al reves no sean del mismo tamaño
what about spaces???
I think this solution not so optimal at the point of memory managment. Using copy for new str is resourcefull operation that allocate new memory for new obj.
Better one is consistant comparison, when we compare letter from end and from start of input string.
.lower()
method for valid compare. Only counting indenfier increase and decrease. So, if we have different letters - loop is over.Please use spoiler flag next time.
This comment is hidden because it contains spoiler information about the solution
This is one of those solutions where you say "of course" out loud when you see it. Very nice
This comment is hidden because it contains spoiler information about the solution
Loading more items...