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.
A switch is easier to read when you have more than 3 options. The compiler will generally create an optimised solution anyway (depending upon the compiler) so it is often better to write code that others can easily read.
Monkey patching 😵
Oh really? 😂😢🥲
This guy 🤣
This comment is hidden because it contains spoiler information about the solution
Ternary expression to check whether the string is longer than 1 char in length, if it's shorter the .substring method will fail so instead just return str. It's good practice to handle edge cases.
Yes, this solution isn't exactly best practice even if it is syntactically short.
This comment is hidden because it contains spoiler information about the solution
Can you please explain the math? Or point us in the direction of an explanation?
Not everyone has specialist math knowledge so the existence of an appropriate algorithm may not be front of mind.
Infinite loops are stopped due to timeout after 12 seconds.