Simple easiest C++ solution


#1
vector<int> Solution::solve(vector<int> &nums) {
    int rmax = 0;
    vector<int>res;
    for(int i=nums.size()-1;i>=0;i--)
    {
        if(nums[i]>rmax)
            res.push_back(nums[i]);
        rmax = max(rmax, nums[i]);
    }
    return res;
}