func dominantIndex(nums []int) int {
max, maxi, max2 := 0, 0, 0
for i, n := range nums {
if n > max {
max, maxi, max2 = n, i, max
} else if n < max && n > max2 {
max2 = n
}
}
if max >= 2 * max2 {
return maxi
}
return -1
}