2
public int maxOperations(int[] nums, int k) {3
HashMap<Integer, Integer> map = new HashMap<>();5
for (int i = 0; i < nums.length; i++) {6
// to check if that k-nums[i] present and had some value left or already paired7
if (map.containsKey(k - nums[i]) && map.get(k - nums[i]) > 0) {9
map.put(k - nums[i], map.get(k - nums[i]) - 1);11
// getOrDefault is easy way it directly checks if value is 0 returns 0 where I added 112
// and if some value is present then it return that value "similar to map.get(i)" and I14
map.put(nums[i], map.getOrDefault(nums[i], 0) + 1);