首页
技术
登录
6mi
u
盘
搜
搜 索
技术
LeetCode11:盛最多水的容器
LeetCode11:盛最多水的容器
技术
2022-07-16
77
class Solution { public int maxArea(int[] height) { int i = 0; int j = height.length-1; int ans = 0; while(i<j){ ans = height[i]<height[j]?Math.max(ans,(j-i)*height[i++]):Math.max(ans,(j-i)*height[j--]); } return ans; } }
转载请注明原文地址:https://ipadbbs.8miu.com/read-27789.html
最新回复
(
0
)