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