Very simple solution O(N)


  • 0
    A

    """

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

    """


Log in to reply
 

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