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.
I know I'm 2 years late, but his code is about ~3 faster. Tested it with 1 and 10 million executions.
Wow, your solution is honeslty great, I'll be taking inspiration to optimize mine as well!
👍
oh wow, this String method avoid adding \ in the pattern way, should we consider this one as better best practices?
For some reason the formulas are easier to read without PEP spacing. Not that you are wrong.
Look at my solution if you want some ideas about how to optimise yours (removing 2nd loop for example).
By the way, instead of parsing int you can use the following ascii tip : s.charAt(i) - '0'.
Look at the ascii table and you will get why it works :)