leetcode-solution 很好的解释,通过动态规划的思想(类似最短路径的求解思想),或反证法可以证明算法的正确性。 code #include<iostream>#include<vector>#include<algorithm>usingnamespacestd;classSolution{public:intmaxArea(vector<int>& height){intm
The above vertical lines are representedbyarray [1,8,6,2,5,4,8,3,7]. Inthiscase,the max area ofwater(blue section) the container can containis49. solution### 第一种解法:暴力解法,也是最容易想到的解法 Copy classSolution{publicintmaxArea(int[] height){intmax =0;for(inti =0; i < ...
残酷刷题群:https://wisdompeak.github.io/lc-score-board/ 视频打卡列表:https://docs.qq.com/sheet/DTWdUcXBmdVptTmlZ (腾讯文档)本题代码与文字解析:https://github.com/wisdompeak/LeetCode/tree/master/Dynamic_Programming/2809.Minimum-Time-to-Make-Array-Sum-At-Most-x...
leetcode_medium_array problem 11. Container With Most Water solution #1: code 参考 1. leetcode_11. Container With Most Water; 完
238. Product of Array Except Self https://www.cnblogs.com/grandyang/p/4650187.html 整体分成左右两个数组进行相乘,这种方式不用两个数组进行存储。 从左向右可以用res[i]就代替前面的乘积,但从右向左就不行了,这个是后res[i]已经是所有的在左侧前方的乘积和,我们还必须计算右侧的乘积和,这个时候用一个变...
Note: You may not slant the container andnis at least 2. The above vertical lines are represented by array [1,8,6,2,5,4,8,3,7]. In this case, the max area of water (blue section) the container can contain is 49. Example: ...