769. Max Number of K-Sum Pairs
0
Medium
Given an array of integers nums and an integer k, find the maximum number of operations you can perform on the array. Each operation involves selecting two numbers from the array whose sum equals k and removing them from the array.
Input Format
The input consists of:
- An integer n denoting the size of the array elements
- n elements denoting the size of the array
- An integer k
Output Format
Output a single integer representing 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