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.
Great solution! I believe we can actually include second 'if' inside the loop and
have a chance to reduce time complexity by up to 50%
LISP
The best kata I have encountered so far. Kudos to aryan-firouzian.
Best way to solve: use paper and pencil & actually think before typing a single line of code.
Go doesn't necesserily require a return (unless you specified a return value when declaring a function), but with switch operator it needs either a default case with return inside or a return outside switch to guarantee the function could execute and exit properly.
Terribly sorry to bother, but do we actually have to check 'i>0' on every iteration?
I mean it only happens once and then this overhead could probably be avoided.
I like the idea of using the minimal comparison needed and therefore minimizing complexity. Bravo! An underrated solution.