← 返回 meta 的题目列表Find Index of Maximum Number in List with Duplicates
类型:online_judge
meta
Given an unsorted list of integers containing duplicates, implement a function to return the index of the maximum number. If the maximum number appears multiple times, return any one of the indices.
Input: A list of integers nums.
Output: An integer representing the index of the maximum number.
Example: Input: [3, 1, 4, 4, 2] Output: 2 (or 3, since the maximum number is 4)
Data Constraints:
The length of the list n is in the range [1, 10^5]
Each element in the list is an integer in the range [-10^4, 10^4].
Example
Input
3 1 4 4 2