Applied Intuition Interview Question

A hard variant of binary search.