单调栈
class Solution {
public:
vector<int> dailyTemperatures(vector<int>& T) {
if(!T.size()) return vector<int>();
vector<int> res(T.size(), 0);
stack<int> stk;
for(int i = 0; i < T.size(); i++)
{
while(stk.size() && T[stk.top()] < T[i])
{
res[stk.top()] = i - stk.top();
stk.pop();
}
stk.push(i);
}
return res;
}
};