Easy JS Solution - Beats 91.55%
\n\n# Code\njavascript []\n/**\n * @param {number[]} nums\n * @return {number[]}\n */\nvar lastVisitedIntegers = function (nums) {\n    const seen = []\n    con
\n\n# Code\n```javascript []\n/**\n * @param {number[]} nums\n * @return {number[]}\n */\nvar lastVisitedIntegers = function (nums) {\n    const seen = []\n    const ans = []\n    let j = 0\n    let k = 0\n    for(let i = 0;  i < nums.length; i++) {\n      const num = nums[i]\n      \n      if(num >= 0) {\n        ++j\n        seen.push(num)\n        k = 0\n      } else {\n        ++k  \n        if(k <= seen.length) {\n          ans.push(seen[seen.length - k])\n        } else {\n          ans.push(-1)\n        }\n      }\n    }\n    \n    return ans\n};\n```
['JavaScript']