Skip to content

Commit 095850e

Browse files
committed
Int overflow를 방지하는 스타일로 변경
1 parent 007c291 commit 095850e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

find-minimum-in-rotated-sorted-array/sonjh1217.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ class Solution {
44
var high = nums.count - 1
55

66
while low <= high {
7-
let mid = (low + high) / 2
7+
let mid = low + (high - low) / 2
88

99
if nums[mid] < nums[mid - 1] {
1010
return nums[mid]

0 commit comments

Comments
 (0)