Problem 373 · Medium

Find K Pairs with Smallest Sums

Find the k pairs with the smallest sums, taking one value from each of two sorted lists. The visual keeps a frontier of candidate pairs in a heap and pops the smallest each step.

Open the interactive visualisation