Search⌘ K

DIY: Searching a 2D Matrix

Explore how to implement a function that searches a target value in a 2D matrix where each row is sorted and the first integer of each row is greater than the last integer of the previous row. Understand how to return a Boolean indicating if the target exists, helping you apply this method to relevant interview problems.

Problem statement

Given an m x n integer matrix and a target value, determine if the target exists in the matrix or not.

The matrix has the following properties:

  • Integers in each row are ...