4.8 Search a 2D Matrix II

4.8.1 Problem Metadata

4.8.2 Description

The matrix is sorted in ascending order both across rows and down columns. Determine whether a target value exists.

4.8.3 Examples

Input: matrix = [[1,4,7,11,15],[2,5,8,12,19],[3,6,9,16,22],[10,13,14,17,24],[18,21,23,26,30]], target = 5
Output: true

4.8.4 Constraints

  • 1 <= m, n <= 300