Mental Model
We look for a number in a grid where each row and column is sorted. We start from a corner and move step by step to find the number or know it is not there.
Analogy: Imagine a library shelf where books are arranged by height from left to right and top to bottom. To find a book of a certain height, you start at the top-right corner and move left if the book is too tall or down if the book is too short.
Matrix: [1, 3, 5, 7] [2, 4, 6, 8] [3, 5, 7, 9] Start at top-right corner: 1 -> 3 -> 5 -> [7 ↑] ↓ ↓ ↓ ↓ 2 4 6 8 ↓ ↓ ↓ ↓ 3 5 7 9
