You are given an integer array nums that contains a single unique maximum value.
Your task is to verify whether this maximum value is at least double every other number in the array.
If this condition holds true, return the index of that maximum value.
Otherwise, return -1.
The comparison must check all other values, ensuring the maximum element is at least twice as large as each one individually.
Input: nums = [10, 2, 5, 1]
Output: 0
Explanation:
Maximum = 10 Other values = 2, 5, 1 10 ≥ 2× each of them → condition satisfied. Index of 10 is 0.
Input: nums = [4, 8, 15, 3]
Output: -1
Explanation:
Maximum = 15 Check: 15 < 2×8 → fails So return -1.
Accepted:
Submission: