Leetcode day 2 and 3

This commit is contained in:
2026-01-29 01:04:37 +05:30
parent 245116d181
commit 2ee49ea476
15 changed files with 204 additions and 1 deletions
+16
View File
@@ -0,0 +1,16 @@
class Solution{
public:
int maxArea(vector<int> &height){
int maxArea = 0;
int left = 0;
int right = height.size()-1;
while(left<right){
maxArea = max(maxArea, (right-left)*min(height[left], height[left]));
if(height[left]<height[right])
left++;
else
right--;;
}
return maxArea;
}
}