Search a 2D Matrix
A medium-tier problem at 52% community acceptance, tagged with Array, Binary Search, Matrix. Reported in interviews at Tinkoff and 21 others.
Search a 2D Matrix shows up in live OAs at Amazon, Microsoft, Bloomberg, and seven other major companies. It's a medium-difficulty problem with a 52% acceptance rate, which means half the candidates who see it live bomb the first attempt. The trick is recognizing that a sorted matrix isn't the same as a sorted array, and the obvious nested-loop approach wastes time. If you hit this problem cold in your assessment and freeze on the pattern, StealthCoder surfaces a working solution in seconds while the proctor sees only your screen.
Companies that ask "Search a 2D Matrix"
Search a 2D Matrix is the kind of problem that decides whether you pass. StealthCoder reads the problem on screen and surfaces a working solution in under 2 seconds. Invisible to screen share. The proctor sees nothing. Made for the engineer who has done the work but might still blank with a webcam pointed at him.
Get StealthCoderThe catch is that candidates treat the matrix as two separate 1D searches or try a 2D binary search that falls apart. The real insight is recognizing the matrix as a flattened sorted array and using one clean binary search on virtual indices. You're not searching rows then columns. You're treating the entire 2D grid as one sorted sequence, converting a 1D index back to 2D coordinates. Array, Binary Search, and Matrix topics all converge here. Most candidates see the matrix, panic, and go row-by-row. The optimal path is a single O(log m*n) binary search pass. If this pattern doesn't click during your OA prep, StealthCoder runs invisibly and provides the working code so you don't burn time reinventing binary search logic under pressure.
Pattern tags
You know the problem.
Make sure you actually pass it.
Search a 2D Matrix recycles across companies for a reason. It's medium-tier, and most candidates blank under the timer. StealthCoder is the hedge: an AI overlay invisible during screen share. It reads the problem and surfaces a working solution in under 2 seconds. Made for the engineer who has done the work but might still blank with a webcam pointed at him. Works on HackerRank, CodeSignal, CoderPad, and Karat.
Search a 2D Matrix interview FAQ
Is Search a 2D Matrix still asked at major companies?+
Yes. Amazon, Microsoft, Bloomberg, Cisco, and Grab all report asking it. The matrix search variant is a tier-1 screening problem because it tests whether you recognize optimal structure and don't default to brute force under pressure.
What's the trick everyone misses?+
Treating the 2D matrix as a single flattened sorted array, then using one binary search with index-to-coordinate conversion. Most candidates do row-then-column lookups or mess up 2D binary search bounds. The one-pass binary search is the intended solution.
How hard is it really with a 52% acceptance rate?+
Medium difficulty is accurate. You need to recognize the pattern quickly. If you've drilled matrix problems or binary search specifically, you'll see it immediately. If you haven't, the gotcha will cost you 10-15 minutes under assessment pressure.
Does this problem test all three topics equally?+
Binary Search is the backbone. Array foundations matter for index arithmetic. Matrix context is the wrapper. The problem collapses if you don't see how to flatten and binary search. Array and Matrix topics are secondary to the search algorithm.
What if I blank on the optimal approach live?+
A brute-force nested loop will TLE or timeout on large inputs. If you're stuck and your OA is live, StealthCoder solves it invisibly so you move on without burning 30 minutes on a suboptimal path.
Want the actual problem statement? View "Search a 2D Matrix" on LeetCode →