- Leetcode-33Search in Rotated Sor
- 33. Search in Rotated Sorted Arr
- leetcode:二分搜索(medium)
- 33. Search in Rotated Sorted Arr
- 33. Search in Rotated Sorted Arr
- 33. Search in Rotated Sorted Arr
- 33. Search in Rotated Sorted Arr
- 33. Search in Rotated Sorted Arr
- 33. Search in Rotated Sorted Arr
- 33. Search in Rotated Sorted Arr
key tips
双下标法,并且子数组分成两个有序数组
algo 1
双下标法加二分搜索
i, j 表示子数组开始、结束下标
m = (i + j) / 2
首先判断哪部分为有序数组([i, m] or [m, j]),并且如果target在该数组内在继续在该数组内二分,否则在另一个数组内二分
递归+分治思想
网友评论