Skip to content

Commit 95a1534

Browse files
committed
Fix
1 parent 995b3ef commit 95a1534

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/main/java/com/thealgorithms/divideandconquer/CountingInversions.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,10 @@ private static int mergeAndCount(int[] arr, int left, int mid, int right) {
7373
System.arraycopy(arr, left, leftArr, 0, mid - left + 1);
7474
System.arraycopy(arr, mid + 1, rightArr, 0, right - mid);
7575

76-
int i = 0, j = 0, k = left, inversions = 0;
76+
int i = 0;
77+
int j = 0;
78+
int k = left;
79+
int inversions = 0;
7780

7881
while (i < leftArr.length && j < rightArr.length) {
7982
if (leftArr[i] <= rightArr[j]) {

0 commit comments

Comments
 (0)