Given n
non-negative integers a1, a2, ..., an
, where each represents a point at coordinate (i, ai)
, n
vertical lines are drawn. Find two lines that together with the x-axis forms a container, such that the container contains the most water.
- Two Pointer Technique
- Optimization
Input: height = [1,8,6,2,5,4,8,3,7]
Output: 49
Input: height = [1,1]
Output: 1
def max_area(height: list[int]) -> int:
# Implement your solution here
pass