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.
So you're saying python isn't for people who want to solve algorithms in O(n) time where possible?
Well, islower() returns False if isalpha() is False, so islower() is actually used to check if the character is alphabetical, since all the alphabetical characters are already lower case, so it will only be False for only non-alphabetical characters. It's not wrong, but it would be more logical and readable if isalpha() was used instead.
You also have to remember that this is codewars. If the code needed to be time critical, the tests would reflect that. Speaking of which, if your code needs to be time critical in the real world, Python isn't the language for you, otherwise it's good enough for most jobs ;)
This comment is hidden because it contains spoiler information about the solution
See the discussion here: https://github.com/codewars/codewars.com/issues/1391
"Efficiency" score is definitely lacking: how many of best algorithmic solutions are buried under mountains of shortest but not so good and/or unreadable ones… :( Maybe a "golf" (shortest) score would end the misuse of the "best practices"?
True
if i.islower()
is not necessary..
you converted the string to lower case in the first row
O(nlogN) -> You can solve it on O(n)
The kata needs to be solved
in-place
, you are using O(N) space for keeping a copy of thea
arrayO(N^2)
This comment is hidden because it contains spoiler information about the solution
Best answer!
Clean code and the most efficient. O(N) and only one pass
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution