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.
Hence it's very slow. sorted + arr.count applied to every element of array.
I think it goes like this: key=arr.count applies this to each element of array, so as it goes through sorted array its value will be 2, 2, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4 on each element (arr.count(12) == 2 and so on...), so max() returns first element that has the highest count, which in sorted array is 7. Docs state that: "If multiple items are maximal, the function returns the first one encountered." For example, if array was not sorted and switched 6 and 7, like [12, 12, 10, 10, 10, 6, 6 ,6 ,6, 7, 7, 7, 7] then it would return 6, since its the first element with highest count. Hope this clears it up.
This comment is hidden because it contains spoiler information about the solution
I like this solution a lot. I had to check it few times to understand but it's perfect.