We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent af16a4a commit 48151faCopy full SHA for 48151fa
Array/pascals-triangle.py
@@ -0,0 +1,11 @@
1
+from itertools import pairwise
2
+from typing import List
3
+
4
+class Solution:
5
+ def generate(self, numRows: int) -> List[int[int]]:
6
+ pascal = [[1]]
7
8
+ for i in range(numRows - 1):
9
+ x = [1] + [a+b for a, b in pairwise(pascal[-1])] + [1]
10
+ pascal.append(x)
11
+ return pascal
0 commit comments