Search
⌘K

Leetcode 378. Kth Smallest Element in a Sorted Matrix

Given an n×n matrix whose rows and columns are sorted in non-decreasing order, return the k-th smallest element (counting duplicates). The core challenge is to exploit the matrix's monotonic structure to avoid O(n^2) space/time — common efficient approaches use a size‑n heap or binary search on values with row-wise counting.

Asked at:

Meta

Amazon

Amazon


Question Timeline

See when this question was last asked and where, including any notes left by other candidates.

Early July, 2025

Meta

Staff

Late January, 2025

Amazon

Amazon

Junior

Find row with max 1's in a row-wise sorted matrix (m, n = 100,000)

Comments

Your account is free and you can post anonymously if you choose.