File tree Expand file tree Collapse file tree 1 file changed +27
-0
lines changed 
docs/algorithm/research/binary-search Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -485,6 +485,33 @@ class Solution:
485485 return  nums[left]
486486``` 
487487
488+ ## 154. 寻找旋转排序数组中的最小值 II  
489+ 
490+ [ 原题链接] ( https://leetcode-cn.com/problems/find-minimum-in-rotated-sorted-array-ii/ ) 
491+ 
492+ ## 思路  
493+ 
494+ 同 153,重点在于如何处理相等情况。
495+ 
496+ ``` python 
497+ class  Solution :
498+  def  findMin (self  , nums : List[int ]) -> int :
499+  length =  len (nums)
500+  left =  0 
501+  right =  length -  1 
502+  while  left <  right:
503+  mid =  (left +  right) //  2 
504+  if  nums[mid] <  nums[right]:
505+  #  在左侧
506+  right =  mid
507+  elif  nums[mid] >  nums[right]:
508+  #  在右侧
509+  left =  mid +  1 
510+  else :
511+  right -=  1 
512+  return  nums[left]
513+ ``` 
514+ 
488515## 162. 寻找峰值  
489516
490517[ 原题链接] ( https://leetcode-cn.com/problems/find-peak-element/ ) 
                                 You can’t perform that action at this time. 
               
                  
0 commit comments