Microsoft Interview Question

It was hard leeetcode Binary Search problem