704. 二分查找
https://leetcode-cn.com/problems/binary-search/
class Solution {
public int search(int[] nums, int target) {
return search(nums,target,0,nums.length - 1);
}
private int search(int[] arr,int target,int low,int high){
if(low > high) return -1;
int mid = (low + high) >> 1;
if(arr[mid] > target){
return search(arr,target,low,mid - 1);
}else if(arr[mid] < target){
return search(arr,target,mid+1,high);
}else{
return mid;
}
}
}