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 one is concise and well-understandable, respect!
Thank you for this! This is what I wanted to do but didn't know how to do, so had to longhand it. This is very neat, thanks for teaching me
This comment is hidden because it contains spoiler information about the solution
Условие очень непонятно...
Very good job, we learn a lot in this solutions sections.
I tried my best to get [X, Y] as a result, but in the end I was just required to get Y
very dirty explanation
Approved
python new test framework is required. updated in this fork
This is good job!
I am not sure where Codewars rules say thay you need to be as fast as possible :)
i mean, codewars is sbout doing it as fast as possible, even if its extremely ugly
Oh boi, I really wanted to flex with those one liners the first time I saw them.
Seems like I'm on the right path to get all the girls.
Since every character in the string has to be touched, assuming 'n' refers to the size of 'aeiouAEIOU' -> 10
String comparison method:
vowel, equal frequencies: 5.5 checks
not a vowel: 10 checks, constant
Set, assuming underlying b-tree has minimal depth:
vowel, equal frequency: 1 * .1 + 2 * .2 + 3 + .4 + 4 * .3 = 2.9 checks
not a vowel: upper bound of 4 checks, lower bound 3 checks
Comparing: vowel 5.5 vs 2.9 -> ~1.90 faster for set
not a vowel: 10 vs 3 to 4 -> 3.33 to 2.5 times faster, in theory
Note: this is in theory, the python interpreter and execution environment could make this worse or better
Obviously as 'n' gets (not much) larger, the set is going to be faster. For n = 10, I would say tradeoff is speed versus speed of coding
Can someone please explain what is happening here?
And why the time complexity of this solution is O(n)?
Loading more items...