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 don't understand why this isn't the top voted solution. It's more efficient and clever than sorting.
Hello there,
I like your solution, which uses set(). I'm not really familiar with Set(). Can you explain the last line (total2 * 2 - total1), why do you need to multiply set by 2?
I've never seen you can increment i++ in the parentesis of your while loop. First, I thought it is impossible. After testing, it works like a charm. I love it and it looks more clear.
Thank you for clarifying. It's working. I should have test it correctly.
I love your approach. However, it won't work for random orders. For example: [5, 11, 12, 7, 0]