Given a sorted integer array nums and an integer target, return the index of target in the array. If it does not exist, return -1.
You must write an algorithm that runs in O(log n) time.
Input: nums = [-1, 0, 3, 5, 9, 12], target = 9 Output: 4 Explanation: 9 is at index 4 in the sorted array.
Input: nums = [-1, 0, 3, 5, 9, 12], target = 2 Output: -1 Explanation: 2 does not exist in the array, so return -1.
nums are unique.nums is sorted in ascending order.nums = [-1, 0, 3, 5, 9, 12] target = 9