mirror of
https://github.com/ShusenTang/LeetCode.git
synced 2024-09-02 14:20:01 +00:00
fix 11
This commit is contained in:
parent
a7a6929b7e
commit
17fdd4c39a
@ -17,8 +17,8 @@ public:
|
|||||||
while(left < right){
|
while(left < right){
|
||||||
int h = min(height[left], height[right]); // 当前容器高度
|
int h = min(height[left], height[right]); // 当前容器高度
|
||||||
res = max(res, h * (right - left));
|
res = max(res, h * (right - left));
|
||||||
while(height[left] <= h) left++; // 跳过高度不够高的
|
while(height[left] <= h && left < right) left++; // 跳过高度不够高的
|
||||||
while(height[right] <= h) right--;
|
while(height[right] <= h && left < right) right--;
|
||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user