Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- func maxArea(height []int) int {
- res :=0
- l,r:=0,len(height)-1
- for l<r {
- area:= (r-l) * min(height[l],height[r])
- res = max(res,area)
- if height[l] < height[r] {
- l++
- }else {
- r--
- }
- }
- return res
- }
- func min(r,l int) int {
- if r < l {
- return r
- }
- return l
- }
- func max(r,l int) int {
- if r > l {
- return r
- }
- return l
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement