376. Max Number of K-Sum Pairs
0
Medium
You are given an integer array nums and an integer k.
In one operation, you can pick two numbers from the array whose sum equals k and remove them from the array.
Return the maximum number of operations you can perform on the array.
Input Format
An integer n denoting size of array elements.
n elements denoting size of array
An integer k
n elements denoting size of array
An integer k
Output Format
The maximum number of operations you can perform on the array.
Example
Input
4
1 2 3 4
5
Output
2
Constraints
1 <= nums.length <= 10^5
1 <= nums[i] <= 10^9
1 <= k <= 10^9
1 <= nums[i] <= 10^9
1 <= k <= 10^9
Loading...
View Submissions
Console