Https://ide.codingblocks.com/#/s/29789

https://ide.codingblocks.com/#/s/29789

Question is matrix search in 2D search, What is wrong?

you have considered 2D array as a 1D array and applied binary search i suppose. But binary search is only valid for sorted arrays.
Please provide question link so that i can verify.

Question Link -> https://hack.codingblocks.com/contests/c/126/705
Solution -> https://ide.codingblocks.com/#/s/29831

only 2nd Test Case fails.
solution work fine for the same problem on Geeks for Geeks.

INPUT:
3 3
4 5 10
5 6 15
7 8 20
15

EXPECTED OUTPUT: 1
OUTPUT: 0

your code will only work in some cases. Test cases at geeks for geeks for weak. You are applying binary search on entire matrix, but matrix is not sorted, it is only row wise and column wise sorted.

HINT:
Try binary search on each row or each column…