scores in which the highest value occurs exactly once. Call the win clear if the best result is at least twice every other result.
If the win is clear, return the index of the best result; otherwise return -1.scores=[4, 15, 7, 0] → 1
The best score is 15 and the runner-up has 7. Since 15 ≥ 2 · 7 = 14, the win is clear, so the answer is index 1.
scores=[10, 6, 3] → -1
10 < 2 · 6 = 12, so the lead is not big enough.
scores=[0, 1] → 1
scores is uniquescores=[4, 15, 7, 0]
1
Run checks the first 3 tests in your browser. Submit checks all 131 tests on the server, hidden ones included.