simple and easy understanding c++ code
\ncpp []\nclass Solution {\npublic:\n    vector<int> nextGreaterElements(vector<int>& nums) {\n        int n=nums.size();\n        vector<int>arr(n,-1);\n      
\n```cpp []\nclass Solution {\npublic:\n    vector<int> nextGreaterElements(vector<int>& nums) {\n        int n=nums.size();\n        vector<int>arr(n,-1);\n        for(int i=0;i<n;i++){\n            for(int j=1;j<n;j++){\n                int a=(i+j)%n;\n            if(nums[a]>nums[i]){\n                arr[i]=nums[a];\n                break;\n            }\n            }\n        }\n        \n        return arr;\n    }\n};\n```
['C++']