Tap here to switch tabs
Problem
Submissions

Problem: Largest Number At Least Twice of Others

med
30 min
Try to solve the Largest Number At Least Twice of Others problem.

Statement

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

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

Constraints:

  • 2≤2 \leq nums.length ≤50\leq 50

  • 0≤0 \leq nums[i] ≤100\leq 100

  • The largest element in nums is unique.

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Largest Number At Least Twice of Others

med
30 min
Try to solve the Largest Number At Least Twice of Others problem.

Statement

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

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

Constraints:

  • 2≤2 \leq nums.length ≤50\leq 50

  • 0≤0 \leq nums[i] ≤100\leq 100

  • The largest element in nums is unique.