🌟 Search a 2D Matrix

Описание к видео 🌟 Search a 2D Matrix

Hello😎, Today I solved a question under "ARRAYS" Topic in Leetcode.
Difficulty : Medium
Array Qs : 74
Platform : LeetCode & GeeksforGeeks

We also have the same question for POTD in GfG.
Currently their #160DaysCoding Challenge is LIVE !!!

Concept: For today's question, to efficiently search for the target element x in a matrix where each row and column is sorted in increasing order, we used the staircase search algorithm. In this, algorithm starts at the top-right corner of the matrix and uses the sorted property of the rows and columns to eliminate portions of the search space.
Firstly, start at the top-right of the matrix:
1. If matrix element=target, return true
2. If matrix element greater than target, decrement j
3. If matrix element less than target, increment i
4. If target not found in matrix, return false



#leetcode #geeksforgeekspotd #geeksforgeeks #coding #youtubeshorts #programming #india #youtube

Комментарии

Информация по комментариям в разработке