Bug Report for python-min-max-shortcut
Opened this issue · 0 comments
Bug Report for https://neetcode.io/problems/python-min-max-shortcut
Please describe the bug below and include any steps to reproduce the bug or screenshots if possible.?title=Bug Report for python-resizable-list-part-1 the solution from typing import List
def in_bounds(grid: List[List[int]], r: int, c: int) -> bool:
rows, cols = len(grid), len(grid[0])
if 0 <= r < rows and 0 <= c < cols:
return True
return False
# Alternative solution:
# return 0 <= r < rows and 0 <= c < cols
do not modify below this line
print(in_bounds([[1, 2, 3], [4, 5, 6], [7, 8, 9]], 0, 0))
print(in_bounds([[1, 2, 3], [4, 5, 6], [7, 8, 9]], 2, 2))
print(in_bounds([[1, 2, 3], [4, 5, 6], [7, 8, 9]], 1, 1))
print(in_bounds([[1, 2, 3], [4, 5, 6], [7, 8, 9]], 4, 3))
print(in_bounds([[1, 2, 3], [4, 5, 6], [7, 8, 9]], 3, 4))
print(in_bounds([[1, 2, 3], [4, 5, 6], [7, 8, 9]], 3, -1))
print(in_bounds([[1, 2, 3], [4, 5, 6], [7, 8, 9]], -1, 3))
for test case print(in_bounds([[1, 2, 3], [4, 5, 6], [7, 8, 9]], -1, 2 ))
gives false while it is accesible
This would be appropriate - if (-row < r < row) and (-col < c < col): ?