//url:https://leetcode.com/problems/next-greater-element-i/description/
//先从nums中,找到每一个元素的目标值
class Solution {
public:
vector nextGreaterElement(vector& findNums, vector& nums) {
map compareMap;
int size=nums.size();
for(int i=0;inums[i]){
compareMap[nums[i]]=nums[j];
break;
}
}
}
size=findNums.size();
vector result;
for(int i=0;i::iterator it=compareMap.find(findNums[i]);
if(it==compareMap.end()){
result.push_back(-1);
}else{
result.push_back(it->second);
}
}
return result;
}
};