Skip to content

Commit 27de797

Browse files
authored
Update create-sorted-array-through-instructions.py
1 parent f7fc331 commit 27de797

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

Python/create-sorted-array-through-instructions.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,8 @@ def largerMergeSort(idxs, start, end, counts):
8181
while r <= mid and idxs[r][0] <= idxs[i][0]:
8282
tmp.append(idxs[r])
8383
r += 1
84-
tmp.append(idxs[i])
84+
if r <= mid:
85+
tmp.append(idxs[i])
8586
counts[idxs[i][1]] += mid - r + 1
8687
while r <= mid:
8788
tmp.append(idxs[r])

0 commit comments

Comments
 (0)