Simplest and Easy understanding solution。


  • 0
    W

    Just go through from end to first:

    class Solution(object):
        def findMin(self, nums):
            """
            :type nums: List[int]
            :rtype: int
            """
            n = len(nums)
            i = n - 1
            while i > 0:
                if nums[i] >= nums[i-1]: i -= 1
                else: break
            return min(nums[0], nums[i])
    

Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.