|
| int | maxArea (vector< int > &height) |
| |
Definition at line 6 of file main.cpp.
◆ maxArea()
| int Solution::maxArea |
( |
vector< int > & |
height | ) |
|
|
inline |
Definition at line 9 of file main.cpp.
10 {
11 int left = 0;
12 int right = (int)height.size() - 1;
13 int volume = min(height[left], height[right]) * abs(right - left);
14 while (left < right)
15 {
16
17 if (height[left] < height[right])
18 left++;
19 else
20 right--;
21
22
23 volume = max(volume, min(height[left], height[right]) * abs(right - left));
24 }
25 return volume;
26 }
Referenced by main().
The documentation for this class was generated from the following file: