Suppose for a function f(x) , for different values of x , f(x) is a bool value yes(y) or no(n) as:-
$$$nnnnnyyyyynnnnn$$$
Also suppose the check function in bsearch returns (-1) if its in the left 'n' block , (0) if its a 'y', and (1) if its in the right 'n' block.
So I need to find the largest value of x for which f(x) is yes(y). Is it doable by binary search?
(Usually we have f(x) varying as $$$yyyyyynnnnnn$$$ or $$$nnnnnnyyyyyy$$$ and in that we can easily use bsearch.)