Bug Report for https://neetcode.io/problems/minimum-path-sum
Please describe the bug below and include any steps to reproduce the bug or screenshots if possible.
Hi, test coverage issue - was having an LLM review my answer and it pointed out that the code shouldn't work in all cases. Something like [[200,200,200]] should be added to prevent the bad outer grid initialization from passing.
class Solution:
def minPathSum(self, grid: List[List[int]]) -> int:
L = 201
m = len(grid)
n = len(grid[0])
answers = [[201]*(n+1) for _ in range(m+1)]
#path to start at
answers[0][1] = 0
for m in range(1,m+1):
for n in range(1,n+1):
curr = grid[m-1][n-1]
prev_path = min(answers[m-1][n],answers[m][n-1])
answers[m][n] = prev_path + curr
print(answers)
return answers[-1][-1]
Bug Report for https://neetcode.io/problems/minimum-path-sum
Please describe the bug below and include any steps to reproduce the bug or screenshots if possible.
Hi, test coverage issue - was having an LLM review my answer and it pointed out that the code shouldn't work in all cases. Something like [[200,200,200]] should be added to prevent the bad outer grid initialization from passing.
class Solution:
def minPathSum(self, grid: List[List[int]]) -> int:
L = 201
m = len(grid)
n = len(grid[0])
answers = [[201]*(n+1) for _ in range(m+1)]