Upper Bound Using Binary Search Leetcode