Problem 1439 · Hard

Find the Kth Smallest Sum of a Matrix With Sorted Rows

Merge the sorted rows one at a time, keeping only the k smallest sums in a heap of (sum, prefix, column) entries.

Open the interactive visualisation