Grokking Data Structures & Algorithms for Coding Interviews
0% completed
Solution: Search a 2D Matrix II
Problem Statement
Given a 2D grid of size m x n, called matrix, that contains integers, and an integer target, return true if the target value exists in the matrix. Otherwise, return false.
The matrix has the following properties:
- Values in each column are sorted in
non-decreasing orderfromtop to bottom, so each value is equal to or greater than the value above it. - Values in each row are sorted in
non-decreasing orderfromleft to right, so each value is equal to or greater than the value to its left.
Examples
Example 1:
.....
.....
.....
Like the course? Get enrolled and start learning!
Reading Progress
0%