MCPcopy Create free account
hub / github.com/codedecks-in/LeetCode-Solutions / Solution

Class Solution

Python/container_with_most_water.py:1–23  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1class Solution(object):
2 def maxArea(self, height):
3 """
4 :type height: List[int]
5 :rtype: int
6 """
7
8 #print(height)
9 start=0
10 end=len(height)-1
11 max_area=0
12 curr_area=0
13 while(start!=end):
14 if(height[start]<height[end]):
15 curr_area=height[start]*(end-start)
16 start+=1
17 else:
18 curr_area=height[end]*(end-start)
19 end-=1
20 if(curr_area>max_area):
21 max_area=curr_area
22 print(curr_area)
23 return max_area

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected