Coding Challenge

Search a 2D Matrix

Medium
matrixbinary-search

Search for a target in a row-wise sorted matrix.

The matrix rows are sorted and the first value of each row is greater than the last value of the previous row. Return true if the target exists.

Examples

Input: matrix = [[1,3,5,7],[10,11,16,20],[23,30,34,60]], target = 3

Output: true

Constraints

  • m and n at least 1

Preparing your coding workspace...