Tap here to switch tabs
Problem
Submissions

Problem: Special Array With X Elements Greater Than or Equal X

med
30 min
Try to solve the Special Array With X Elements Greater Than or Equal X problem.

Statement

You are given an array of non-negative integers nums.

The array nums is considered special if there exists an integer x such that there are exactly x elements in nums that are greater than or equal to x.

Return x if the array is special; otherwise, return −1-1.

Note: The integer x does not necessarily have to be an element in nums.

Constraints:

  • 1≤1 \leq nums.length ≤100\leq 100

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

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Special Array With X Elements Greater Than or Equal X

med
30 min
Try to solve the Special Array With X Elements Greater Than or Equal X problem.

Statement

You are given an array of non-negative integers nums.

The array nums is considered special if there exists an integer x such that there are exactly x elements in nums that are greater than or equal to x.

Return x if the array is special; otherwise, return −1-1.

Note: The integer x does not necessarily have to be an element in nums.

Constraints:

  • 1≤1 \leq nums.length ≤100\leq 100

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