Given a sorted array of integers and a target value, return the index of target in the array. If target is not present, return -1.
Input
arr: sorted array of integers
target: value to search for
Output
The index of target in arr, or -1 if not found.
Examples
Example 1
Inputarr = [1, 2, 3, 4, 5], target = "hello"
Output-1
Explanation: target is not present in arr.
Example 2
Inputarr = [10, 20], target = "a"
Output-1
Constraints
arr is sorted in non-decreasing order.
Must run in O(log n) time.