84.柱状图中的最大矩形
int largestRectangleArea(vector<int> &height)
{
int ret = 0;
height.push_back(0);
stack<int> index;
for (int i = 0; i < height.size(); i++) {
while(!index.empty() && height[index.top()] >= height[i]) {
int h = height[index.top()];
index.pop();
int rightX = index.size() > 0 ? index.top() : -1;
ret = max(ret, h * (i - rightX - 1));
}
index.push(i);
}
return ret;
}