Checking whether coordinate (row, col) is valid or not. >>> is_safe(0, 0, 5, 5) True >>> is_safe(-1,-1, 5, 5) False
(row: int, col: int, rows: int, cols: int)
| 19 | |
| 20 | |
| 21 | def is_safe(row: int, col: int, rows: int, cols: int) -> bool: |
| 22 | """ |
| 23 | Checking whether coordinate (row, col) is valid or not. |
| 24 | |
| 25 | >>> is_safe(0, 0, 5, 5) |
| 26 | True |
| 27 | >>> is_safe(-1,-1, 5, 5) |
| 28 | False |
| 29 | """ |
| 30 | return 0 <= row < rows and 0 <= col < cols |
| 31 | |
| 32 | |
| 33 | def depth_first_search(row: int, col: int, seen: set, mat: list[list[int]]) -> int: |
no outgoing calls
no test coverage detected