Given a sorted (ascending) array of distinct integers nums and an integer target, return the index of target, or -1 if it is not present.
Your algorithm must run in O(log n) time.
Example 1
Input: nums = [-1,0,3,5,9,12], target = 9
Output: 4
Example 2
Input: nums = [-1,0,3,5,9,12], target = 2
Output: -1
Constraints
1 <= nums.length <= 100000Input
nums = [-1,0,3,5,9,12], target = 9
Expected
4
5 hidden tests run on submit