You are given an array of integers nums, find the index of its maximum element. If there are multiple occurrences of the maximum element, return the index of the first occurrence.
If the array is empty, return -1.
[1, 3, 2]
1
The maximum element is 3, which is at index 1.
[5, 2, 5, 1]
0
The maximum element is 5. The first occurrence is at index 0.
[-10, -5, -20]
1
The maximum element is -5, which is at index 1.
[1, 3, 2]
1