Skip to content

Commit

Permalink
refactor(11): improve code readability and remove print
Browse files Browse the repository at this point in the history
  • Loading branch information
DeNice-r committed Dec 31, 2023
1 parent 213fece commit bf7b97e
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions 1-100/11. Container With Most Water.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
from typing import List


def solve(height: List[int]) -> int:
x, y, mx = [0] * 3

while x < len(height) - 1:
while y < len(height):
mx = max(mx, (y - x) * min(height[x], height[y]))
y += 1
x += 1
y = x + 1
return mx


assert solve([1, 8, 6, 2, 5, 4, 8, 3, 7]) == 49
assert solve([1, 1]) == 1

0 comments on commit bf7b97e

Please sign in to comment.