```
int maxArea(vector<int>& height) {
return maxAreaRec(height, 0, height.size()-1);
}
int maxAreaRec(vector<int>& height, int i, int j) {
return i == j ? 0 :
(height[i] > height[j] ? max(maxAreaRec(height, i, j-1), height[j] * (j - i))
: max(maxAreaRec(height, i+1, j), height[i] * (j - i)));
}
```