MCPcopy Index your code
hub / github.com/neetcode-gh/leetcode / value

Method value

java/0119-pascals-triangle-ii.java:14–19  ·  view source on GitHub ↗
(int row, int col, int[][] dp)

Source from the content-addressed store, hash-verified

12 }
13
14 public int value(int row, int col, int[][] dp) {
15 if (row == 0 || col == 0 || col == row) return 1;
16 if (dp[row][col] != 0) return dp[row][col];
17 dp[row][col] = value(row - 1, col - 1, dp) + value(row - 1, col, dp);
18 return dp[row][col];
19 }
20
21 /** Iterative approach to solving the problem - follows Neetcode's solution in Python
22 * O(n) time complexity

Callers 1

getRowMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected