首页 > 编程语言 > 详细

11. Container With Most Water C++

时间:2018-11-13 01:27:18      阅读:142      评论:0      收藏:0      [点我收藏+]

方法1:Brute Force(执行时间惨不忍睹,共进行)

class Solution {
public:
    int maxArea(vector<int>& height) {
        int res=0;
        for(int i=0;i<height.size();i++)
            for(int j=i+1;j<height.size();j++)
                res = max(res,min(height[i],height[j])*(j-i));
        return res;
    }
};

技术分享图片

 

11. Container With Most Water C++

原文:https://www.cnblogs.com/tornado549/p/9949825.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!