values and an integer target. In one move you pick two elements of the array (at different positions) whose sum equals target and remove both of them.
Return the largest number of moves you can make.values=[2, 7, 4, 5, 3, 6], target=9 → 3
Remove 2 and 7, then 4 and 5, then 3 and 6: three moves, and the array is empty.
values=[4, 4, 4, 1], target=8 → 1
Two of the 4s form a pair; the third 4 has no partner left, and 1 adds up to 8 with nothing.
values=[10], target=10 → 0
values=[2, 7, 4, 5, 3, 6], target=9
3
Run checks the first 3 tests in your browser. Submit checks all 69 tests on the server, hidden ones included.