3397. Maximum Number of Distinct Elements After Operations
You are given an integer array
nums
and an integerk
.You are allowed to perform the following operation on each element of the array at most once:
- Add an integer in the range
[-k, k]
to the element.Return the maximum possible number of distinct elements in
nums
after performing the operations.
1 | class Solution { |