CLASS OUTLINE
1. Homework review
2. Leetcode exercise - Pascal's triangle
a. https://leetcode.com/problems/pascals-triangle/
3. Depth first search
a. https://replit.com/@paracorde/PromotedScaredAddition#main.py
b. More references @ https://usaco.guide/gold/bfs?lang=cpp
4. Leetcode exercise - Grids
a. https://leetcode.com/problems/minimum-path-cost-in-a-grid/
Homework - Create a program to run BFS on a grid maze. BFS uses queues instead of recursion to ensure all nodes the same distance away are evaluated at the same time, so it will always give the shortest path.
class Solution(object):
def generate(self, numRows):
"""
:type numRows: int
:rtype: List[List[int]]
"""
s = []
for i in range(0, numRows):
t = [1] * (i+1)
for k in range(len(t)):
if k == 0 or k == len(t)-1:
continue
else:
t[k] = s[i-1][k-1]+s[i-1][k]
s.append(t)
return s