Doubt in Staircase Search

I have done this already. here is my code.
could you suggest me better code than i have written
for this if possible?

@shubham.mehla2000 hey shubham I have also used this approach.

1 Like

hey @shubham.mehla2000, this much more optimised than regular bruteforce. Stick to it.

1 Like

hey @shubham.mehla2000, please mark this doubt as resolved if no further queries.

1 Like

could you please also show me the code of brute force method.

hey @shubham.mehla2000, brute force approach of search is like scanning each row one by one or scanning each column one by one.

This method optimised as we are taking advantage of the condition that array is sorted along the row and column.