Skip to content

Commit ff81dc3

Browse files
committed
Aug 01
1 parent 4265e28 commit ff81dc3

File tree

2 files changed

+26
-2
lines changed

2 files changed

+26
-2
lines changed
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
class Solution:
2+
def generate(self, numRows: int) -> list[list[int]]:
3+
triangle = [[1]]
4+
for i in range(1, numRows):
5+
row = [1]
6+
for j in range(1, i):
7+
row.append(triangle[i - 1][j - 1] + triangle[i - 1][j])
8+
row.append(1)
9+
triangle.append(row)
10+
return triangle
11+
12+
13+
def main():
14+
assert Solution().generate(5) == [[1],
15+
[1, 1],
16+
[1, 2, 1],
17+
[1, 3, 3, 1],
18+
[1, 4, 6, 4, 1]]
19+
20+
assert Solution().generate(1) == [[1]]
21+
22+
23+
if __name__ == '__main__':
24+
main()

2025-08-August-LeetCoding-Challenge/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
## Questions
55
| Day | Problem | Level | Status |
66
| --- | --- | --- | --- |
7-
| August 01 | []() | | |
7+
| August 01 | [118. Pascal's Triangle](https://leetcode.com/problems/pascals-triangle/) | Easy | Solved |
88
| August 02 | []() | | |
99
| August 03 | []() | | |
1010
| August 04 | []() | | |
@@ -40,6 +40,6 @@
4040
## Summary
4141
| Level | Problems | Solved | Unsolved |
4242
| --- | --- | --- | --- |
43-
| Easy | 0 | 0 | 0 |
43+
| Easy | 1 | 1 | 0 |
4444
| Medium | 0 | 0 | 0 |
4545
| Hard | 0 | 0 | 0 |

0 commit comments

Comments
 (0)