Skip to content

Commit 329fc6c

Browse files
Update algorithms/graphs/min_cost_valid_path/__init__.py
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
1 parent 963b8f3 commit 329fc6c

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

algorithms/graphs/min_cost_valid_path/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,8 @@ def is_valid(row: int, col: int) -> bool:
145145

146146

147147
def min_cost_0_1_bfs_2(grid: List[List[int]]) -> int:
148+
if not grid:
149+
return 0
148150
# Store the number of rows and columns of grid
149151
num_rows, num_cols = len(grid), len(grid[0])
150152

0 commit comments

Comments
 (0)