python easy solution | beats 99.43% | using stack operation
\nclass Solution(object):\n    def nextGreaterElements(self, nums):\n\n        n=len(nums)\n        stack= []\n\t\tnext_g=[-1] * n\n        \n        \n        
```\nclass Solution(object):\n    def nextGreaterElements(self, nums):\n\n        n=len(nums)\n        stack= []\n\t\tnext_g=[-1] * n\n        \n        \n        for i in range(n):\n            \n            while stack and (nums[stack[-1]] < nums[i]):\n                \n                next_g[stack.pop()] = nums[i]\n            \n                \n            stack.append(i)\n        \n        \n        for i in range(n):\n            \n            while stack and (nums[stack[-1]] < nums[i]):\n                \n                next_g[stack.pop()] = nums[i]\n                \n            if stack == []:\n                \n                break\n        \n        return next_g\n```\n\n**if you like do upvote !**
['Python']