Solution (source code)

= Solution

Write $v=f[0,N-1]$, assuming $M,N>0$. By <monotonicity>, $v$ is at least every value in the first row and at most every value in the last column. Hence
$$
\boxed{\begin{aligned}
v=x&\implies (0,N-1)\text{ is a solution},\\
v<x&\implies \text{discard row }0,\\
v>x&\implies \text{discard column }N-1.
\end{aligned}}
$$
The same observation applies to the top-right corner of any remaining rectangular <subarray> of this <monotone matrix>.