Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 6790225

Browse files
author
Ram swaroop
committed
comment corrections
1 parent ab635b1 commit 6790225

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/me/ramswaroop/arrays/EquilibriumIndex.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public static int getEquilibriumIndex(int[] a) {
3434
}
3535

3636
for (int i = 0; i < a.length; i++) {
37-
totalSum -= a[i]; // totalSum now holds the right sum
37+
totalSum -= a[i]; // totalSum now holds the right sum from ith index to end
3838
if (leftSum == totalSum) {
3939
return i; // left sum == right sum
4040
}

src/me/ramswaroop/arrays/SubsetOfArray.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ public class SubsetOfArray {
1616
* <p/>
1717
* Explanation: The below method uses sorting + merge method of merge sort. Time
1818
* complexity is O(mlogm + nlogn) where m and n are lengths of array a and b resp.
19-
* You could also have used sorting + binary search but this fails when superset
20-
* array has repeating elements for example, a={1,4,4,2} and b={1,4,2}. Time
19+
* You could also have used sorting + binary search but this fails when array
20+
* {@param b} has repeating elements for example, a={1,4,2} and b={1,4,4,2}. Time
2121
* complexity would be O(mlogm + nlogm).
2222
*
2323
* @param a

0 commit comments

Comments
 (0)