Skip to content

Commit 09a4252

Browse files
authored
Update two-city-scheduling.py
1 parent 45bd3c3 commit 09a4252

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

Python/two-city-scheduling.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,11 @@ def PartitionAroundPivot(left, right, pivot_idx, nums, compare):
2727
while left <= right:
2828
pivot_idx = random.randint(left, right)
2929
new_pivot_idx = PartitionAroundPivot(left, right, pivot_idx, nums, compare)
30-
if new_pivot_idx == k - 1:
30+
if new_pivot_idx == k:
3131
return
32-
elif new_pivot_idx > k - 1:
32+
elif new_pivot_idx > k:
3333
right = new_pivot_idx - 1
34-
else: # new_pivot_idx < k - 1.
34+
else: # new_pivot_idx < k.
3535
left = new_pivot_idx + 1
3636

3737
kthElement(costs, len(costs)//2, lambda a, b: a[0]-a[1] < b[0]-b[1])

0 commit comments

Comments
 (0)