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

Method getRow

java/0119-pascals-triangle-ii.java:5–12  ·  view source on GitHub ↗
(int rowIndex)

Source from the content-addressed store, hash-verified

3class Solution {
4
5 public List<Integer> getRow(int rowIndex) {
6 List<Integer> ans = new ArrayList<>();
7 int[][] dp = new int[rowIndex + 1][rowIndex + 1];
8 for (int i = 0; i <= rowIndex; i++) {
9 ans.add(value(rowIndex, i, dp));
10 }
11 return ans;
12 }
13
14 public int value(int row, int col, int[][] dp) {
15 if (row == 0 || col == 0 || col == row) return 1;

Callers

nothing calls this directly

Calls 4

valueMethod · 0.95
addMethod · 0.45
setMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected