LeetCode 011 Container With Most Water

LeetCode 011 Container With Most Water Problem

Download Code
class Solution:
    def maxArea(self, height: List[int]) -> int:
        # Two points
        left, right = 0, len(height) - 1
        result = 0
        while left < right:
            result = max(min(height[left], height[right]) * (right - left), result)
            if height[left] > height[right]:
                # remove right
                right -= 1
            else:
                # remove left
                left += 1
        return result
Download Container With Most Water.py

List of all Container With Most Water problems

Leetcode 011 Container With Most Water problem solution in python3 with explanation. This is the best place to expand your knowledge and get prepared for your next interview.

Feedback is the most important part of any website.

If you have any query, suggestion or feedback, Please feel free to contact us.