Upper Bound Using Binary Search Code