public static List<List<Integer>> generate(int numRows) {List<List<Integer>> list = new ArrayList<>();for (int i = 0; i < numRows; i++) {List<Integer> tmpList = new ArrayList<>();for (int j = 0; j <= i; j++) {int elem = 1;if (j > 0 && j < i) {List<Integer> lastRow = list.get(list.size() - 1);elem = lastRow.get(j) + lastRow.get(j - 1);}tmpList.add(elem);}list.add(tmpList);}return list;}