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 cba335b commit 0fdb30eCopy full SHA for 0fdb30e
python/119-Pascal-Triangle-II.py
@@ -1,28 +1,15 @@
1
-class Solution:
2
-
3
- Memo = {}
4
5
- def getRow(self, rowIndex: int) -> List[int]:
6
7
- if rowIndex in self.Memo:
8
+class Solution:
+ Memo = {}
+ def getRow(self, rowIndex: int) -> List[int]:
+ if rowIndex in self.Memo:
9
return self.Memo[rowIndex]
10
11
if rowIndex == 0:
12
13
return [1]
14
15
ListPrec = self.getRow(rowIndex - 1)
16
17
Result = [1]
18
19
for i in range(0, len(ListPrec) - 1):
20
21
Result.append(ListPrec[i] + ListPrec[i + 1])
22
23
- Result.append(1)
24
+ Result.append(1)
25
self.Memo[rowIndex] = Result
26
27
return Result
28
0 commit comments