← All problemsSign in

2598. Smallest Missing Non-negative Integer After Operations

LeetCodeArrayHash TableMathGreedyOpen on judge ↗

You are given a 0-indexed integer array nums and an integer value. In one operation, you can add or subtract value from any element of nums. - For example, if nums = [1,2,3] and value = 2, you can choose to subtract value from nums[0] to make nums = [-1,2,3]. The MEX (minimum excluded) of an array is the smallest missing non-negative integer in it. - For example, the MEX of [-1,2,3] is 0 while

HINT LADDERno hints yet
L1 Observation
L2 Technique
L3 Approach
L4 Pseudo-code
🔒
L5 Full solution
L5 unlocks only if you insist twice
solution.cppC++17

CodeSearch Tutor

Hints, not spoilers — it won’t hand over the full solution unless you insist.

voice by Sarvam AI

Sign in to chat with the tutor and save your progress.

Sign in to start