Classic ACM binary search, very good, no regrets