LeetCode Find Minimum in Rotated Sorted Array

BabbleDay posted @ 2015年7月17日 17:08 in 刷题防身 with tags python array leetcode Find Minimum in Rotated Sorted , 995 阅读

默认递增,一旦递减就返回

def findMin(self, nums):
        rtn = nums[0]
        for i in range(len(nums)-1):
            if nums[i+1]<rtn:
                return nums[i+1]
        return rtn

 

优化至O(logN)

Avatar_small
Click Here For More 说:
2019年12月24日 21:29

In order to become a PGA pro, a candidate must have attained the age of 18 years and should have a high school diploma. He should also have proof that he is a citizen of the USA. He has to clear PAT or player ability test in which two rounds of golf are played. Each round has a target score and the candidate has to score below the given score Click Here For More Information.


登录 *


loading captcha image...
(输入验证码)
or Ctrl+Enter