Airbnb interview question

Leetcode binary search style question with a mathematical twist