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.
nice radix conversion from int to string
counting matches of '1' is simple, and could easily scale to higher radixes such as octal
could easily be extended to match multiple digits, such as .count('137')
range traversal is clear
accumulator function sum() over a list is also a nice aggregate function
I did the same thing. However I am not sure if its faster than the hardcoded solution
very clever!
Is that solution same as if function that select in each operator or it will process all the operator function?
Every thing that is hard coded or using simple functions should be faster
No, it's not. In fact, over a high number of invocations of the function, it probably actually be slower (allocation + hashing + lookup vs string comparison) The point of this isn't performance, it's convenience.
This looks very nice. But could anyone tell if this is really faster than the mundane if else control flow method?
Thanks.
This doesn't work in Python 3, round() has been changed for worse for some reason.
So interesting solution
Smart!
Great :)
This is so smart
Unfortunately, the above code results to Execution Time Out, maybe due to tests with extremely long arrays, which were added afterwards.
very interesting!
This comment is hidden because it contains spoiler information about the solution
Loading more items...