Code Room
CodingMedium
Question
Given an m x n integer matrix where each row is sorted ascending left-to-right and each column is sorted ascending top-to-bottom, determine whether a target value exists in the matrix. Return True or False. Aim for O(m + n) time. The matrix has at least one row and one column.
Implement
search_matrix_staircase(matrix: list[list[int]], target: int) → boolExamples
in
[[[1,4,7,11],[2,5,8,12],[3,6,9,16],[10,13,14,17]],5]outtrueWhat 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.