Javascript easy stack solution
```\nvar nextGreaterElements = function(nums) {\n    let n = nums.length;\n    let stack =[];\n    let result = new Array(n).fill(-1)\n    for(let i=0; i<2*n;i+
```\nvar nextGreaterElements = function(nums) {\n    let n = nums.length;\n    let stack =[];\n    let result = new Array(n).fill(-1)\n    for(let i=0; i<2*n;i++){\n        while(stack.length && nums[i%n]>nums[stack[stack.length-1]]){\n            result[stack.pop()]= nums[i%n]\n        }\n        stack.push(i%n)\n    }\n    return result;\n};
['Stack', 'JavaScript']