
Given an n x n matrix where each row and each column is sorted in nondecreasing order, and an integer k (1 ≤ k ≤ n^ 2), return the k-th smallest element in the matrix. Compare approaches using a min-heap over row heads versus value-space binary search with counting, and analyze complexities and edge cases.