求盛最多水的容器
程序员文章站
2024-02-01 15:52:28
/** * @param {number[]} height * @return {number} */ var maxArea = function(height) { let maxarea = 0 for(let i=0;i=0; j--){ maxarea = Math.max(maxare... ......
/** * @param {number[]} height * @return {number} */ var maxArea = function(height) { let maxarea = 0 for(let i=0;i<height.length; i++){ for(let j=height.length-1; j>=0; j--){ maxarea = Math.max(maxarea,Math.min(height[i],height[j])*((i-j)>0?(i-j):(j-i))) } } return maxarea };
上一篇: ps给图片加上漂亮的边框