❇ next-greater-element-ii👌 🏆O(N)❤️ Javascript❤️ Memory👀95.45%🕕 Meaningful Vars✍️ 🔴❇ ✅ 👉 💪🙏
\nvar nextGreaterElements = function (nums2) {\n  const slicedArrayButLast = nums2.slice(0, nums2.length - 1)\n  const updatedArray = [...nums2, ...slicedArrayB
```\nvar nextGreaterElements = function (nums2) {\n  const slicedArrayButLast = nums2.slice(0, nums2.length - 1)\n  const updatedArray = [...nums2, ...slicedArrayButLast]\n  const store = [updatedArray[updatedArray.length - 1]]\n  const nextGreatElements = [-1]\n  for (let index = updatedArray.length - 1 - 1; index >= 0; index--) {\n    const tempStore = store[store.length - 1] > updatedArray[index]\n    if (tempStore) {\n      nextGreatElements.push(store[store.length - 1])\n    } else {\n      while (store[store.length - 1] <= updatedArray[index]) {\n        store.pop()\n        if (!store.length) {\n          break\n        }\n      }\n      if (!store.length) {\n        nextGreatElements.push(-1)\n      } else {\n        nextGreatElements.push(store[store.length - 1])\n      }\n    }\n    store.push(updatedArray[index])\n  }\n  nextGreatElements.reverse()\n  return nextGreatElements.slice(0, nums2.length)\n}\n```
['Stack', 'Queue', 'JavaScript']