Given a sorted (ascending) array of distinct integers nums and an integer target, return the index of target in nums, or -1 if it is not present.
Your algorithm must run in O(log n) time.
Examples
Example 1
Input: nums = [-1, 0, 3, 5, 9, 12], target = 9
Output: 4Example 2
Input: nums = [-1, 0, 3, 5, 9, 12], target = 2
Output: -1Constraints
1 <= nums.length <= 10⁴-10⁴ < nums[i], target < 10⁴- All integers in
numsare unique and sorted in ascending order.