Most Common Value
Every number in nums is a whole number from 0 to 20. Return the value that appears most often. If several values tie, return the smallest of them. Hint: np.bincount.
Example 1
nums [2,5,5,2,7]
returns 2
2 and 5 both appear twice; the smaller is 2.
Constraints
1 <= len(nums) <= 100- Every number is a whole number from 0 to 20
Write it in your browser, against the clock. The model solution, stepped through line by line, comes after.
More NumPy problems
- Most Different PositionEasy
- Outlier CountEasy
- Pair DifferencesEasy
- Percent ChangeEasy
- Row RangesEasy
- Rows With a ZeroEasy
- Rows of WidthEasy
- Runner-Up per RowEasy