End of Year Sale: Use Coupon Code END2025 to Get Extra 25% Off.
left at 0 and right at nums.length - 1.left is less than or equal to right:
a. Calculate the middle index mid as (left + right) / 2.
b. If nums[mid] is equal to target, return mid.
c. If nums[mid] is less than target, move the left pointer to mid + 1.
d. Else, move the right pointer to mid - 1.-1.