Hi, here’s your problem today. This problem was recently asked by Amazon:
Given a 2d n x m
matrix where each cell has a certain amount of change on the floor, your goal is to start from the top left corner mat[0][0]
and end in the bottom right corner mat[n - 1][m - 1]
with the most amount of change. You can only move either left or down.
Here’s some starter code:
def max_change(mat):
# Fill this in.
mat = [
[0, 3, 0, 2],
[1, 2, 3, 3],
[6, 0, 3, 2]
]
print(max_change(mat))
# 13