You are given an array of integers and a number k.
In one move, you can choose any two numbers from the array whose sum equals k, and then remove those two numbers from the array.
Your task is to count how many such removal operations can be performed in total until no more valid pairs remain.
Input: nums = [2, 8, 4, 6, 10], k = 12
Output: 2
Explanation:
Remove (2, 10) → remaining: [8, 4, 6] Remove (8, 4) → remaining: [6] No more pairs.
Input: nums = [5, 5, 5, 5], k = 10
Output: 2
Explanation:
Pairs: (5, 5), (5, 5)
Accepted:
Submission: