class Solution {
public:
vector<int> dailyTemperatures(vector<int>& temperatures) {
vector<int> res;
int tt=0;
int temp[100010];
for(int i=temperatures.size()-1;i>=0;i--){
while(tt&&temperatures[temp[tt]]<=temperatures[i]) tt--;
if(tt) res.push_back(temp[tt]-i);
else res.push_back(0);
temp[++tt]=i;
}
reverse(res.begin(),res.end());
return res;
}
};
标签:temp,int,每日,leetcode,vector,temperatures,739,tt
From: https://www.cnblogs.com/karson3/p/17157514.html