var maxArea = function (height) {
var dp = [0];
var max = 0;
for (var i = 1; i < height.length; i++) {
dp[i] = 0;
for (var j = 0; j < i; j++) {
var v = (i - j) * Math.min(height[i], height[j]);
dp[i] = Math.max(dp[i], v);
}
max = Math.max(max, dp[i]);
}
// console.log(dp, max);
return max;
};
var maxArea = function (height) {
var i = 0;
var j = height.length - 1;
var max = 0;
while (i < j) {
max = Math.max(max, Math.min(height[i], height[j]) * (j - i));
if (height[i] < height[j]) i++;
else j--;
}
return max;
};
def max_area(height)
i, j, max = 0, height.length-1, 0
while i < j
v = height.values_at(i,j).min * (j - i)
max = [max, v].max
if height[i] < height[j]
i += 1
else
j -= 1
end
end
max
end