Tap here to switch tabs
Problem
Submissions

Problem: Smallest Missing Non-negative Integer After Operations

med
30 min
Try to solve the Smallest Missing Non-negative Integer After Operations problem.

Statement

You are given an integer array nums and an integer value.

In an operation, you can add or subtract value to or from any element of nums. This operation can be applied any number of times to any element.

Return the maximum MEX (minimum excluded value) of nums that can be obtained after applying any number of operations.

Note: The MEX of an array is the smallest integer greater than or equal to 00 that is not present in the array.

Constraints:

  • 1≤1 \leq nums.length, value ≤105\leq 10^5

  • −109≤-10^9 \leq nums[i] ≤109\leq 10^9

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Smallest Missing Non-negative Integer After Operations

med
30 min
Try to solve the Smallest Missing Non-negative Integer After Operations problem.

Statement

You are given an integer array nums and an integer value.

In an operation, you can add or subtract value to or from any element of nums. This operation can be applied any number of times to any element.

Return the maximum MEX (minimum excluded value) of nums that can be obtained after applying any number of operations.

Note: The MEX of an array is the smallest integer greater than or equal to 00 that is not present in the array.

Constraints:

  • 1≤1 \leq nums.length, value ≤105\leq 10^5

  • −109≤-10^9 \leq nums[i] ≤109\leq 10^9