2598. Smallest Missing Non-negative Integer After Operations
You are given a 0-indexed integer array
numsand an integervalue.In one operation, you can add or subtract
valuefrom any element ofnums.
- For example, if
nums = [1,2,3]andvalue = 2, you can choose to subtractvaluefromnums[0]to makenums = [-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]is0while the MEX of[1,0,3]is2.Return the maximum MEX of
numsafter applying the mentioned operation any number of times.
1 |
|