From 22181e1a17038143fc4cdf8ce704b085458c7cf2 Mon Sep 17 00:00:00 2001 From: asmhatre Date: Mon, 9 Nov 2026 08:53:28 +0000 Subject: [PATCH] dynamic-programming: rename loop variable in UniquePaths.oneRow (WordPress reads [c] as a shortcode in the article) --- .../src/main/java/com/ankurm/interviewlab/dp/UniquePaths.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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]; }