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.
...except you still have to get the name's length, which is O(n) as well.
Wow, guess I learned something new today! :D
Good thing the input isn't unknown then.
This comment is hidden because it contains spoiler information about the solution
Even though it's asking to rewrite the code, this is easier to understand, uses fewer lines of code and is simpler. In my opinion, this is a perfect solution since it teaches you what is most efficient instead of just doing what the problem asks.
No, it doesn't.
Here's a profile of running this problem 10 million times with an if/if/if solution versus an if/elif/else solution:
Even if it did, if you care about nanoseconds you shouldn't be choosing different flow control syntax in Python, you should be choosing a different language.
if elif else statement works faster than if if if
This comment is hidden because it contains spoiler information about the solution
"grow a pair" programming is about making safe stable and all around good code, they obviously just gave some good feedback.
the task was not to rewrite the function but to fix it
Grow a pair haha
I wanna sushiii
?!?!?!??!?!?!?!?!??!?!?!?
Very clear!
yes, this kata only asked to fix the bug in the code. not rewrite the entire code.
Loading more items...