Find Minimum in Rotated Sorted Array ( LeetCode ) Problem Solution.
Find the minimum element.
You may assume no duplicate exists within the array.
Example 1:
Input: [3,4,5,1,2] Output: 1
Example 2:
Input: [4,5,6,7,0,1,2] Output: 0
Solution:-
class Solution:
def findMin(self, nums: List[int]) -> int:
return min(nums)
Runtime: 36 ms, faster than 84.53% of Python3 online submissions for Find Minimum in Rotated Sorted Array.
Memory Usage: 14.1 MB, but 6.00% of Python3 online submissions for Find Minimum in Rotated Sorted Array.


0 Comments