Trains the technique from
LeetCode 74Search a 2D MatrixThis is an original problem, written from a brief that listed the technique, the difficulty, the topics, the function shape and the input bounds — none of that problem's wording, examples, hints or editorials. The link is there so you can map your practice onto the standard set.
Same function shape, different story and different numbers.
A calibration archive keeps signed offset readings in fixed-width pages. You are given pages, a list of m pages of n readings each, laid out so that:
Given an integer probe, report whether that exact reading is filed anywhere in the archive.
Return true when the archive holds probe, otherwise false. The archive can be large, so your lookup must run in time logarithmic in the total reading count m * n; walking every page is too slow.
Example 1
Reading 11 sits in the second slot of the second page, so the archive holds it.
Example 2
Nothing between 1 and 6 was ever filed, so 5 is absent even though it falls inside the archive's range.
Example 3
Pages of a single reading are allowed; the last page carries 10.
The editor is preloaded with this. It matches the parent problem's shape, so a solution that works here transfers to a judge unchanged.
def locate_offset(pages: list[list[int]], probe: int) -> bool:public boolean locateOffset(int[][] pages, int probe)See the step-by-step animation, the intuition, and clean code in every language — free, no credit card.