Easy Python Solution 🐍 || O(N)
Code\n\nclass Solution:\n    def lastVisitedIntegers(self, words: List[str]) -> List[int]:\n        k,li,ans=0,[],[]\n        for i in words:\n            if i=
# Code\n```\nclass Solution:\n    def lastVisitedIntegers(self, words: List[str]) -> List[int]:\n        k,li,ans=0,[],[]\n        for i in words:\n            if i==\'prev\':\n                k+=1\n                if k>len(li):\n                    ans.append(-1)\n                else:\n                    ans.append(li[-k])\n            else:\n                k=0\n                li.append(int(i))\n        return ans\n```\n***Hope it helps...!!*** \uD83D\uDE07\u270C\uFE0F
['Array', 'String', 'Python', 'Python3']