Code Room
CodingMedium
Question
You are given an m x n matrix where each row is sorted ascending left-to-right and each column is sorted ascending top-to-bottom. Given a target, return [row, col] of an occurrence (0-indexed), or [-1, -1] if absent. Aim for O(m + n). Constraints: 1 <= m, n <= 300, -10^9 <= values, target <= 10^9.
Implement
search_sorted_matrix(matrix: list[list[int]], target: int) → list[int]Examples
in
[[[1,4,7,11],[2,5,8,12],[3,6,9,16],[10,13,14,17]],5]out[1,1]What a strong answer looks like
State your approach and its time/space complexity out loud before you optimize. Handle the edge cases (empty input, duplicates, overflow), and say why you chose this over the brute force. Green tests are the floor, not the grade.
Learn the concepts
Vibe coding: describe the solution in plain language (or narrate it) and the coach grades your approach. Generating runnable code from your description is coming next.
Run or narrate your approach, then ask the coach.