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.
The array result has been sorted such that the value in the first index represents the cashier with the shortest line. Because this is a greedy algorithm, the optimal solution involves adding this next customer to the shortest line (time wise). Does that help?
During each iteration, the array is sorted. result[0] is the slot with the smallest value, the next register that can take a customer. Initializing result to size n creates the a slot for each "register".