C++ Neat
\nclass Solution {\npublic:\n    vector<int> nextGreaterElements(vector<int>& nums) {\n        int n = nums.size();\n        stack<int> s;\n        vector<int> 
```\nclass Solution {\npublic:\n    vector<int> nextGreaterElements(vector<int>& nums) {\n        int n = nums.size();\n        stack<int> s;\n        vector<int> result(n, -1);\n        for (int i = 0; i < n * 2; i++) {\n            while (!s.empty() && nums[i % n] > nums[s.top()]) {\n                result[s.top()] = nums[i % n];\n                s.pop();\n            }\n            s.push(i % n);\n        }\n        return result;\n    }\n};\n```
['Stack', 'C']