Simple C++ Solution using two loops || Begginers Friendly
Code\n\nclass Solution {\npublic:\n    vector<int> nextGreaterElements(vector<int>& nums) {\n        vector<int> res;\n        int y=0,x=-1;\n        for (int i
# Code\n```\nclass Solution {\npublic:\n    vector<int> nextGreaterElements(vector<int>& nums) {\n        vector<int> res;\n        int y=0,x=-1;\n        for (int i=0;i<nums.size();i++){\n            y=nums[i];\n            for(int j=i+1;j<nums.size()+i;j++){\n                if(nums[j%nums.size()]>y){x=0;res.push_back(nums[j%nums.size()]);break;}\n            }\n            if(x!=0){res.push_back(-1);}\n            x=-1;\n        }\n        return res;\n    }\n};\n```
['C++']