We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 676c4f0 commit 4000157Copy full SHA for 4000157
11. Container With Most Water
@@ -0,0 +1,25 @@
1
+class Solution {
2
+public:
3
+ int maxArea(vector<int>& height) {
4
+
5
+ int final_area=0;
6
+ int temp_area=0;
7
8
+ for(int i=0; i< height.size()-1; i++){
9
+ for(int j = height.size()-1; j > i; j--){
10
11
+ if(height[i] < height[j]){
12
+ temp_area = height[i] * (j-i);
13
+ }
14
+ else{
15
+ temp_area = height[j] * (j-i);
16
17
18
+ if(temp_area > final_area)
19
20
+ final_area=temp_area;
21
22
23
+ return final_area;
24
25
+};
0 commit comments