Staircase search

Sir please correct the code

You are not taking the inputs properly.Check this thread:

sir but inputs can be taken in both ways as taught in our course
sir why flag variable is taken

flag variable was taken to check if the key is found in the matrix or not. If it is found, the flag variable will hold 1 otherwise it will hold 0.

sir can we not increment i-- or j++ separately .is it required to do it as shown in your code a[i][j–]

Sir please correct my code

Your code is not staircase search. You are using 2 loops.So it is the brute force one. Staircase search is the one with linear time complexity as taught by Prateek bhaiya in the lecture video .Please watch the video again and refer the code as i have shared. Dry run it with any sample case. I will help if you are unable to understand something in that.