Loading...
Loading...
Loading...
A shop records the product codes of items sold. Print the codes so that codes sold more often come first. Codes sold equally often are in increasing order, and every sale is printed.
Example 1
Input
4 5 6 5 4 3
Output
4 4 5 5 3 6
Example 2
Input
2 2 1
Output
2 2 1
Try the problem first. Open one hint at a time.
Count each code first.
A sort key can be a tuple: (negative count, value).
Write your Python code, run it on the examples and submit it to hidden tests.
Solve in the editor