Skip to content

Commit d65cc0c

Browse files
committed
Fix
1 parent bc8c9ee commit d65cc0c

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
*
1818
* <p>This class cannot be instantiated, as it is intended to provide
1919
* only static utility methods.
20+
*
21+
* @author Hardvan
2022
*/
2123
public final class CountingInversions {
2224
private CountingInversions() {
@@ -83,7 +85,7 @@ private static int mergeAndCount(int[] arr, int left, int mid, int right) {
8385
arr[k++] = leftArr[i++];
8486
} else {
8587
arr[k++] = rightArr[j++];
86-
inversions += (mid + 1) - (left + i);
88+
inversions += mid + 1 - left - i;
8789
}
8890
}
8991

0 commit comments

Comments
 (0)