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.
lol
try printing your inputs for the fixed and random tests.
I pass when I run the sample tests, but when I hit attempt I get an indexError which makes no sense. It works fine when I run it in Pycharm with the array that gave me an indexError here. My code also produces correct results when I run all of the tests found in the instructions in Pycharm.
Interesting Kata. Thank u dude.
The
set
class doesn't supportoperator[]
. It's contents aren't stored in a linear data structure, it's some sort of tree or hash table. So even if[]
were supported, the underlying logic will still be linear run-time. The iterator allows me to access the elements in order of insertion. So by inserting in a strictly ascending fashion, I can recover that order with an iteration loop. If you want to see an array based approach, check out g964's solution. It's probably better than mine. My C solution is also array based, but it's not dynamic. I guesstimate the maximum value ofn
.why don't u just return u[n] at last ? It may remove the last loop I think.
wow, yet you are the another who uses exception I've seen. Huhhhhh
return the longest substring(which is palindrome)'s length... It's really confuse
So celver your solution is!