Problem
You are given a list of integers nums and an integer k. In one operation you pick two numbers whose sum equals `k` and remove them from the list. Return the maximum number of operations you can perform. Each element can be used at most once.
Example 1
- Input
- nums = [1, 2, 3, 4], k = 5
- Output
- 2
- Why
- remove 1 and 4, then 2 and 3
Example 2
- Input
- nums = [3, 1, 3, 4, 3], k = 6
- Output
- 1
- Why
- remove two 3s; the last 3 has no partner
Constraints
1 <= nums.length <= 10^51 <= nums[i] <= 10^91 <= k <= 10^9