leetle

Daily challenge for 2025-11-16

320. Largest Number At Least Twice of Others

You are given an integer array nums where the largest integer is unique.

Determine whether the largest element in the array is at least twice as much as every other number in the array. If it is, return the index of the largest element, otherwise return -1.

Example:
Input: nums = [3,6,1,0]
Output: 1

Explanation: 6 is the largest and 6 >= 3 * 2, so return index 1.

Example 2:
Input: nums = [1,2,3,4]
Output: -1

Explanation: 4 is not at least twice as large as 3.

Run this challenge interactively in Python or JavaScript when the app loads.