[Python] brute force
python\nclass Solution:\n    def lastVisitedIntegers(self, words: List[str]) -> List[int]:\n        nums = []\n        res = []\n        idx = -1\n\n        for
```python\nclass Solution:\n    def lastVisitedIntegers(self, words: List[str]) -> List[int]:\n        nums = []\n        res = []\n        idx = -1\n\n        for w in words:\n            if w != \'prev\':\n                nums.append(int(w))\n                idx = len(nums) - 1\n                continue\n            \n            if idx < 0:\n                res.append(-1)\n                continue\n\n            res.append(nums[idx])\n            idx -= 1\n            \n        return res\n```
['Python']