Skip to content

Commit d684771

Browse files
committed
for negative heights
1 parent 7f9f1f1 commit d684771

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Diff for: dynamic_programming/trapped_water.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ def trapped_rainwater(height: list[int]) -> int:
2828
"""
2929
if not height or height == []:
3030
return 0
31-
if any(height < 0):
31+
if any(h < 0 for h in height):
3232
raise ValueError("No height can be negative")
3333
length = len(height)
3434

0 commit comments

Comments
 (0)