Stair case search

question–>
https://practice.geeksforgeeks.org/problems/search-in-a-matrix17201720/1#
code–>


it is showing segmentation fault help!!

Hey, I am unable to see your code at given ide link, please make sure that your link is correct.

Hey, instead of starting from (0, m-1). start from (n-1, 0) that way if the current element is less than target move to next column else move to next row.

okay i got it, when i erased the condition
a[s][e]!=X
the code started working fine it passed all test cases why was that?

offcourse there are other ways of iterating the matrix but this way is more intuitive hence less chances of a buggy code, thats why I recommended the same.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.