Skip to content

Commit ad2075f

Browse files
solution: 42
1 parent 3f5840d commit ad2075f

File tree

1 file changed

+1
-24
lines changed

1 file changed

+1
-24
lines changed

solutions/42/01.py

Lines changed: 1 addition & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -39,27 +39,4 @@ def trap(height):
3939
if water > 0:
4040
res += water
4141

42-
return res
43-
44-
45-
# Example usage and testing
46-
if __name__ == "__main__":
47-
# Test case 1
48-
height1 = [0,1,0,2,1,0,1,3,2,1,2,1]
49-
print(f"Input: {height1}")
50-
print(f"Output: {trap(height1)}") # Expected: 6
51-
52-
# Test case 2
53-
height2 = [4,2,0,3,2,5]
54-
print(f"\nInput: {height2}")
55-
print(f"Output: {trap(height2)}") # Expected: 9
56-
57-
# Edge case: empty array
58-
height3 = []
59-
print(f"\nInput: {height3}")
60-
print(f"Output: {trap(height3)}") # Expected: 0
61-
62-
# Edge case: single element
63-
height4 = [5]
64-
print(f"\nInput: {height4}")
65-
print(f"Output: {trap(height4)}") # Expected: 0
42+
return res

0 commit comments

Comments
 (0)