Search⌘ K
AI Features

DIY: Search a 2D Matrix II

Understand how to solve the problem of searching for a target value in a 2D matrix where each row and column is sorted ascending. Learn to implement an efficient searchMatrix function that returns true if the target exists. This lesson helps develop your skills in handling matrix search problems common in coding interviews.

Problem statement

Write an algorithm that searches for a target value in an m x n integer matrix.

The matrix has the following properties:

  • Integers in each row are sorted in ascending ...