human
Give me a Python code to find the minimum element given the following:
Solve in Python:
Suppose an array sorted in ascending order is rotated at some pivot unknown to you beforehand.

(i.e.,  [0,1,2,4,5,6,7] might become  [4,5,6,7,0,1,2]).

Find the minimum element.

The array may contain duplicates.

Example 1:

Input: [1,3,5]
Output: 1

Example 2:

Input: [2,2,2,0,1]
Output: 0

Note:

       This is a follow up problem to Find Minimum in Rotated Sorted Array.
       Would allow duplicates affect the run-time complexity? How and why?
assistant
#Here is Python code to find the minimum element.

class Solution:
     def findMin(self, nums):
         l = 0
         r = len(nums) - 1
         res = nums[r]
         while l < r:
             if nums[l] < nums[r]:
                 return min(nums[l],res)
             res = min(res,nums[r])
             m = int((l+r)/2)
             if nums[l] == nums[r]:
                 temp = nums[r]
                 while nums[l] == temp and l < r:
                     l = l + 1
                 while nums[r] == temp and l < r:
                     r = r - 1
             elif nums[m] >= nums[l]:
                 l = m + 1
             elif nums[m] <= nums[r]:
                 res = min(nums[m],res)
                 r = m - 1
         return min(nums[l],res)
         """
         :type nums: List[int]
         :rtype: int
         """