Skip to content

Commit 27dddb9

Browse files
authored
Remove explanation from comments
1 parent e31138c commit 27dddb9

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

java/238-Product-of-Array-Except-Self.java

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,13 @@ public int[] productExceptSelf(int[] nums) {
1717
return arr;
1818
}
1919

20-
// using nums[] as the prefix calculation table
2120
public int[] productExceptSelfNumsAsPrefix(int[] nums) {
2221
int[] output = new int[nums.length];
23-
output[0] = 1; // default prefix is 1.
22+
output[0] = 1;
2423

25-
// prefix
2624
for (int i = 0; i < nums.length - 1; i++)
2725
output[i + 1] = output[i] * nums[i];
2826

29-
// postfix
30-
// we start at nums.length - 2 because multiplying by 1 is silly.
3127
for (int i = nums.length - 2; i >= 0; i--) {
3228
output[i] = nums[i + 1] * output[i];
3329
nums[i] = nums[i] * nums[i + 1];

0 commit comments

Comments
 (0)