Skip to content

Commit 4bb44a2

Browse files
Update 0153-find-minimum-in-rotated-sorted-array.py
Prevent integer overflow in find minimum in rotated sorted array, python
1 parent 7a76b54 commit 4bb44a2

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

python/0153-find-minimum-in-rotated-sorted-array.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ def findMin(self, nums: List[int]) -> int:
44
curr_min = float("inf")
55

66
while start < end :
7-
mid = (start + end ) // 2
7+
mid = start + (end - start ) // 2
88
curr_min = min(curr_min,nums[mid])
99

1010
# right has the min

0 commit comments

Comments
 (0)