Java: Search a 2D Matrix

Level : Intermediate
Mentor: Amit Kumar Ghosh
Type : GuidedLab
Points : 10
Duration : 00:20:00

Lab Details

Difficulty Level: MEDIUM

Problem Statement:

You are given an m x n integer matrix matrix with the following two properties:

  • Each row is sorted in non-decreasing order.
  • The first integer of each row is greater than the last integer of the previous row.

Given an integer target, return true if the target is in the matrix or false otherwise.

Input:

matrix = [

  [1, 3, 5, 7],

  [10, 11, 16, 20],

  [23, 30, 34, 50]

]

Output:

true

The sum of -1, -1 and 2 is 0. The Sum of -1, 0, and 1 is also 0.

Self-paced Membership
  • 24+ Video Courses
  • 825+ Hands-On Labs
  • 400+ Quick Notes
  • 125+ Skill Tests
  • 10+ Interview Q&A Courses
  • 10+ Real-world Projects
  • Career Coaching Sessions
  • Email Support
Upto 60% OFF
Know More
Still have some questions? Let's discuss.
CONTACT US
Accept cookies & close this