• Courses
  • Tutorials
  • Jobs
  • Practice
  • Contests
May 17, 2023 |2.0K Views
Search in a Row-wise and Column-wise Sorted Matrix
  Share  2 Likes
Description
Discussion

In this video, we will discuss a problem in which we have to find whether a number is present in the matrix or not, given the matrix is sorted in increasing order. The number(x) and matrix(n x m) is given in the problem statement, we have to return output in 0 or 1 as answer.

For Example :

Input: n=4, m=4, x=29 &

mat[4][4] =  {{10, 20, 30, 40},  
                     {15, 25, 35, 45},
                     {27, 29, 37, 48},
                      {32, 33, 39, 50}}

Output: 1

Checkout, the video for the complete explanation with implementation.

Practice Problem: https://practice.geeksforgeeks.org/problems/search-in-a-matrix-1587115621/1
Article: https://www.geeksforgeeks.org/search-in-row-wise-and-column-wise-sorted-matrix/
SDE Sheet: https://www.geeksforgeeks.org/sde-sheet-a-complete-guide-for-sde-preparation/

Read More