Implement binary search variants | Uber Interview Question