每天的好心情从EZ题开始
class Solution {
public List<List<Integer>> generate(int numRows) {
List<List<Integer>> res = new ArrayList<>();
int[][] arr = new int[numRows][numRows];
for(int i = 0; i < numRows; i++){
List<Integer> sublist = new ArrayList<>();
for(int j = 0; j <= i; j++){
if(j == 0 || j == i){
arr[i][j] = 1;
} else {
arr[i][j] = arr[i - 1][j - 1] + arr[i - 1][j];
}
sublist.add(arr[i][j]);
}
res.add(sublist);
}
return res;
}
}