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.
You can click 'view solution' under my message to see the O(n) answer. If you're asking about the complexity calculations themselves, try the book 'Elements of Programming Interviews'.
The line "if l!=2:" is redundant, though I also suggest using elif and else for clarity
This solution increments checked numbers by 1, but we can increment the right-most unit once maxSum is exceeded. For example, if maxSum is 3 and the current number is 190000, enourmous time is saved by incrememting by 10000 rather than 1.
See my implementation here. achieving 1650ms compared to this solution's 3200ms. There are also ways to further improve the incrementing efficiency.
https://www.codewars.com/kata/reviews/55f6846f1eb6c5b0f000006a/groups/62ffe16b747aae000149c41c
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution