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.
why was the Ladder class created if it is not used anywhere?
This solution is elegant, but has poor performance due to the fact that the sum of the digits of a single number can be calculated more than once in the sort() function.
So the complexity is O(m⋅logm⋅k), where
"m" is the number of numbers,
"k" is the average length of the number.
My solution calculates the weights once, so its complexity is O(m⋅k+m⋅logm).
On the other hand, if we assume that "k" is 2, that is, a constant (hardly anyone weighs more than 999), then the complexity in this and in my case becomes equal to O(m⋅logm). In addition, my solution consumes more memory. So decide for yourself what you like best.