Use a divide-and-conquer algorithm to find elements in a sorted array.
Asked in the Onsite round 4 stage. Implement binary search for one target value.
Given a sorted list nums of integers and an integer target, return the index of target, or -1 if it is absent. If duplicates exist, return any valid index.
Example 1: nums = [1, 3, 5, 7, 9], target = 7 returns 3 because nums[3] == 7.
Example 2: nums = [2, 4, 6, 8], target = 5 returns -1 because 5 is not present.
def search_sorted_array(nums, target):