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 comment is hidden because it contains spoiler information about the solution
2^0
?That is not a requirement though. Neither by description, nor by test.
Also insertion-order preservation in dictionaries depends on the python version.
Best regex solution!
But the import should be at the top of the file.
Hey gentoomaniac, I think this is just a misunderstanding of the output. The function should return the number of characters that repeat, not the number of times that the characters repeat. In the test case you mentioned, the number 2 refers to how many letters repeat in that string--in this case two letters ("a" and "b") repeat (number of times is irrelevant), so the ouput is 2.
literally a recursive directory creation.
Had to do this :)
Approved it, wonderful translation. Thanks again!
The examples in the description don't reflect the case insensitivity.
As a suggestion remove one lowercase b in
"aabbcdeB" -> 2 # 'a' and 'b'
I ran into this as I primarily looked in the examples ;)
Otherwise a nice one imo
only draw back in this version is the inefficient ammount of recursions.
e.g. if n=1000 you would otherwise run down to n<1 which is not necessary (easy to solve ;))
besides that you might as well break if n == 2 as we know this to be true. No need to to another call to isPowerOfTwo(1) ;)
os.system is dangerous. IIRC os.system will spawn a shell, so you're vulnurable to code injection.