You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
classSolution {
public:intmaxArea(vector<int>& height) {
int left =0;
int right = height.size() - 1;
int max = 0;
int current = 0;
while (left < right) {
int wall = std::min(height[left], height[right]);
current = wall * (right - left);
if (current > max) {
max = current;
}
if (height[left] < height[right]) {
left++;
} else {
right--;
}
}
return max;
}
};
The text was updated successfully, but these errors were encountered: