FazeelUsmani / Amazon-SDE-Preparation

This repository includes all the interview preparation questions for Amazon SDE role
https://practice.geeksforgeeks.org/batch/Amazon-Test-Series
1.12k stars 291 forks source link

Create 05 searchInRowColumn.cpp #66

Closed Juro221 closed 3 years ago

Juro221 commented 3 years ago

First we check if number that we want to search can be in our matrix. If it can be in our matrix we start searching. We start searching from top left corner of matrix. Max number of moves we can make to find our number is n+m. Time Complexity : O(n+m)