Top Three Values
Return the three largest items of nums, from the largest to the smallest. Equal values are separate items, so [5, 5, 2, 1] gives [5, 5, 2].
nums always has at least three items.
Example 1
nums [4,9,1,7,3]
returns [9,7,4]
In order from the top the items are 9, 7, 4, 3, 1. The first three are the answer.
Example 2
nums [5,5,2,1]
returns [5,5,2]
Both 5s count, and then comes 2.
Example 3
nums [3,1,2]
returns [3,2,1]
With exactly three items the answer is the whole list, sorted downwards.
Constraints
3 <= len(nums) <= 30-100 <= nums[i] <= 100
Write it in your browser, against the clock. The model solution, stepped through line by line, comes after.