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
Cant believe i didn't think of that, DOH!
first time I solved something so easily and it was the first solution (I'm always trying to get the same solution as the first, even if I know how to write it less elegantly)
nice way to keep it simple and understandable
It's a variable within/passed to a function, so he's not modifying anything outside the local scope right?
nice
Is it really a "Best practcie" to overwrite a variable?
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
I'm not too sure, but I think these builtins are internally written in C, making them automatically blazing fast. Calling the solution "horribly inefficient" is really dramatic. On the grand scheme of things, this is still an O(n) solution. It is also incredibly readable. I have run some cursory benchmarks and the "inefficient" method gobsmacks yours for all list lengths I've tried (we're talking around more than 3x faster than yours). Take this with a grain of salt since they're informal tests, but it should hopefully make you reconsider making hasty performance comments in the future. I'll attach it spoilered below.
can't think of any other solution
This comment is hidden because it contains spoiler information about the solution
It looks simple and clean. But it actually consumes more time than a for loop.
Why is this low in Best Practices?
Loading more items...