Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug Report for python-min-max-shortcut #3969

Open
slackroo opened this issue Mar 27, 2025 · 0 comments
Open

Bug Report for python-min-max-shortcut #3969

slackroo opened this issue Mar 27, 2025 · 0 comments

Comments

@slackroo
Copy link

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): ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant