Code Room
CodingMedium
Question
Given an m x n matrix where each row is sorted ascending left-to-right and the first integer of each row is greater than the last integer of the previous row (i.e. the matrix is fully sorted in row-major order), determine whether a target value exists. Return True or False. Do it in O(log(m*n)). Dimensions up to 100 x 100.
Implement
search_matrix(matrix: list[list[int]], target: int) → boolExamples
in
[[[1,3,5,7],[10,11,16,20],[23,30,34,60]],3]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.