python stack
\ndef nextGreaterElements(self, nums: List[int]) -> List[int]:\n        size = len(nums)\n        nums+=nums\n        res = [-1] * size\n        stack = []\n   
```\ndef nextGreaterElements(self, nums: List[int]) -> List[int]:\n        size = len(nums)\n        nums+=nums\n        res = [-1] * size\n        stack = []\n        for i in list(range(size))*2:\n            while stack and (nums[stack[-1]] < nums[i]):\n                res[stack.pop()] = nums[i]\n            stack.append(i)\n        return res\n```
['Python', 'Python3']