diff --git a/dynamic-programming/src/main/java/com/ankurm/interviewlab/dp/UniquePaths.java b/dynamic-programming/src/main/java/com/ankurm/interviewlab/dp/UniquePaths.java index 878572b..405bdf3 100644 --- a/dynamic-programming/src/main/java/com/ankurm/interviewlab/dp/UniquePaths.java +++ b/dynamic-programming/src/main/java/com/ankurm/interviewlab/dp/UniquePaths.java @@ -31,12 +31,12 @@ public final class UniquePaths { return table(rows, cols)[rows - 1][cols - 1]; } - /** One row: row[c] already holds the cell above, row[c-1] is the cell to the left. */ + /** One row: row[col] already holds the cell above, row[col-1] is the cell to the left. */ public static long oneRow(int rows, int cols) { long[] row = new long[cols]; java.util.Arrays.fill(row, 1); for (int r = 1; r < rows; r++) { - for (int c = 1; c < cols; c++) row[c] += row[c - 1]; + for (int col = 1; col < cols; col++) row[col] += row[col - 1]; } return row[cols - 1]; }