Added binary search for finding solution for non-decreasing func