Search in Rotated Sorted Array II
https://leetcode.com/problems/search-in-rotated-sorted-array-ii/description/
Follow up for "Search in Rotated Sorted Array": What if duplicates are allowed?
Would this affect the run-time complexity? How and why?
Tips
不能再用binary search了,因为pivot elements可以重复后start 和end都可以等于pivot, 无法再判断mid是在前段还是后段。
Code
Analysis
O(n)
Last updated
Was this helpful?