Skip to content

Commit 4519ca0

Browse files
committed
Adding Efficient Solution for Problem - 153 - Find Minimum Rotated Sorted Array
1 parent 08232b9 commit 4519ca0

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
##==================================
2+
## Leetcode
3+
## Student: Vandit Jyotindra Gajjar
4+
## Year: 2020
5+
## Problem: 153
6+
## Problem Name: Find Minimum in Rotated Sorted Array
7+
##===================================
8+
#
9+
#Suppose an array sorted in ascending order is rotated at some pivot unknown to you beforehand.
10+
#
11+
#(i.e., [0,1,2,4,5,6,7] might become [4,5,6,7,0,1,2]).
12+
#
13+
#Find the minimum element.
14+
#
15+
#You may assume no duplicate exists in the array.
16+
#
17+
#Example 1:
18+
#
19+
#Input: [3,4,5,1,2]
20+
#Output: 1
21+
#
22+
#Example 2:
23+
#
24+
#Input: [4,5,6,7,0,1,2]
25+
#Output: 0
26+
class Solution:
27+
def findMin(self, nums):
28+
nums.sort() #Sort the nums list
29+
return min(nums) #Return the minimum element in nums list

0 commit comments

Comments
 (0)