You are given an integer array nums and an integer k. You can perform the following operation on the array any number of times:
i in the array (where 1 <= i <= k) and increment nums[i] by 1.Your goal is to maximize the number of distinct elements in the array after performing the operations.
Return the maximum number of distinct elements you can achieve.
` Input: nums = [1,2,2,3,2], k = 2 Output: 4 Explanation: We can perform the following operations:
Input: nums = [1,2,2,3,2], k = 0 Output: 4 Explanation: Since k = 0, we cannot perform any operations, so the maximum number of distinct elements we can achieve is the number of distinct elements in the array itself.
Input: nums = [1,1,1,1,1,1], k = 2 Output: 2 Explanation: Regardless of how many times we perform the operation, we can only increase the value of the first two elements at most. Hence, the maximum number of distinct elements we can achieve is 2.
n == nums.length1 <= n <= 1050 <= nums[i] <= 1051 <= k <= 105