classSolution:defmaxArea(self,height:List[int])->int:# Init varsmax_area=0start_index=0end_index=len(height)-1whilestart_index!=end_index:# Get heightstart_height=height[start_index]end_height=height[end_index]# Find min heightmin_height=0ifstart_height>end_height:min_height=end_heightelse:min_height=start_height# Get area and compare with max_areaarea=min_height*(end_index-start_index)ifarea>max_area:max_area=area# Move index of min heightifstart_height>end_height:end_index=end_index-1else:start_index=start_index+1returnmax_area