码迷,mamicode.com
首页 > 编程语言 > 详细

11. Container With Most Water C++

时间:2018-11-13 02:30:38      阅读:112      评论:0      收藏:0      [点我收藏+]

标签:分享   image   bubuko   int   ima   bsp   执行时间   vector   height   

方法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++

标签:分享   image   bubuko   int   ima   bsp   执行时间   vector   height   

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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!