Search
⌘K

Leetcode 2387. Median of a Row Wise Sorted Matrix

Given an R×C matrix where each row is sorted in non-decreasing order, find the median (the middle element if the matrix were flattened) without fully sorting all elements. The typical solution uses binary search on the value range and counts, for each candidate, how many elements in each row are ≤ that value to locate the median efficiently.


Question Timeline

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

Comments

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