LeetCode: Container with Most Water

Question :- https://leetcode.com/problems/container-with-most-water/description/

Solution:-

class Solution:
    def maxArea(self, height) -> int:
        len_height = len(height)
        max_area = 0
        for hgt in range(0,len_height):
            for sub_hgt in range(0,len_height):
                if sub_hgt ==hgt:
                    continue
                else:
                    if height[hgt] <= height[sub_hgt]:
                        area = height[hgt]*abs(hgt - sub_hgt)
                        if max_area<area:
                            max_area = area
        return max_area

Comments