Matrix search or staircase search

it is always printing 0
pls see the code

Apply the logic same as that in staircase search video in your course. You just have to pick the top right element in the array and start traversing from there accordingly. Watch that lecture first and then try.

i have already watched the video and then solved this question but i m not able to get the mistake

Check now.