題意是有個高度數組,就相當於隔板的高度,求數組中任意兩隔板間盛水的最大量。隔板間的距離與較低隔板的高度乘積即為盛水的容量。 int maxArea(vector<int> &height) { int ...
題目描述: Given n non negative integers a , a , ..., an , where each represents a point at coordinate i, ai . n vertical lines are drawn such that the two endpoints of line i is at i, ai and i, . Find two ...
2018-06-12 16:10 1 2154 推薦指數:
題意是有個高度數組,就相當於隔板的高度,求數組中任意兩隔板間盛水的最大量。隔板間的距離與較低隔板的高度乘積即為盛水的容量。 int maxArea(vector<int> &height) { int ...
Given n non-negative integers a1, a2, ..., an, where each represents a point at coordinate (i, ai). ...
Container With Most Water 題目鏈接 Given n non-negative integers a1, a2, ..., an, where each represents a point at coordinate (i, ai). n vertical lines ...
原題地址:https://oj.leetcode.com/problems/container-with-most-water/ 題意: Given n non-negative integers a1, a2, ..., an, where each represents a point ...
題目:Given n non-negative integers a1, a2, ..., an, where each represents a point at coordinate (i, ai ...
一、題目說明 11.Container With Most Water,這個題目難度是Medium。 二、我的做法 乍一看,簡單啊,兩個for循環就可以了,我在本地寫的。 提交后運行,居然Time Limit Exceeded是,好傷心。 里面給了一個非常長的數據,實際上我本地 ...
題目描述 給定 n 個非負整數 a1,a2,...,an,每個數代表坐標中的一個點 (i, ai) 。畫 n 條垂直線,使得垂直線 i 的兩個端點分別為 (i, ai) 和 (i ...
Given n non-negative integers a1, a2, ..., an , where each represents a point at coordinate (i, a ...