Write solve(nums, target) that returns the index of target in the sorted list nums, or -1 if it is not present.
Binary Search
Examples
- solve([1,3,5,7,9], 5) → 2
- solve([1,3,5,7,9], 4) → -1
Write solve(nums, target) that returns the index of target in the sorted list nums, or -1 if it is not present.
Examples