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
This comment is hidden because it contains spoiler information about the solution
Forgot about a booby trap - dividing null))) With the "for"-loop everything is ok!
make sure you check that n!=0, otherwise you will have an endless loop that would cause the timeout. otherwise, idk either
I wrote same code, but for some reason server timed out, IDK
OMG!Wasted so much time and didn't even think about it! Very clever solution!
This comment is hidden because it contains spoiler information about the solution
you don't have to check every time n !== 0 case. if before everything else,if you check !n case and return, you would reduce execution time and redundancy.Also it's not good practice to mutate input.
very clever
More readable write with line breaks)
Like the others said using just n/10 will give you an infinite loop because you are always checking the original n%10===0 condition for the same number so the loop will always get true.
Yeah, it would be the same as writing
while(n % 10 === 0) 50 / 10;
(or similar). Basically, a calculation is performed and then thrown away unless you have an=
somewhere to set a variable to this new value.Just took the average time to execute between this and several other solutions. This is the most performant!
thats what i did cause i i had trouble doing a switch case.
That's what i did haha
Loading more items...