Array
1679. Max Number of K-Sum Pairs
Repeatedly remove two numbers summing to k; maximise the number of such operations. Sort and use two pointers from the ends — the smallest and largest — pairing them up.
Loading…
Repeatedly remove two numbers summing to k; maximise the number of such operations. Sort and use two pointers from the ends — the smallest and largest — pairing them up.
Loading…