Logo
IconChallenge
Icon
IconProblem
IconSolutions
IconSubmissions

Smallest Absent Positive Greater Than Average

XPChallenge Points: 10
levelLevel: Easy

You are given an integer array nums.
Your task is to find the smallest missing positive integer that is strictly greater than the average of all elements in the array.
The average of the array is defined as:
average=
number of elements / sum of all elements
The answer must satisfy:
1. It is positive (greater than 0).
2. It is not present in nums.
3. It is strictly greater than the average of the array.
4. It is the smallest integer that meets these conditions.
​

Example 1:

Input: nums = [4, 8, 6]

Output: 7

Example 2:

Input: nums = [1, 3, 7, 9]

Output: 6

to Continue
like
dislike

Accepted:

Submission:

IconReport an issue
Icon
IconCode
IconYou need toto run or submitYou need toto run or submit
IconTest Case
IconTest Result