🟢🔴🟢 Beats 100.00%👏 Best Solution 🟢🔴🟢
```\nclass Solution {\n  List<int> lastVisitedIntegers(List<int> nums) {\n\n    List<int> seen = [];\n    List<int> ans = [];\n    int k = 0;\n    for(int i = 0; i < nums.length; i++){\n        if(nums[i] == -1){\n            k++;\n            if(k > seen.length){\n                ans.add(-1);\n            }else{\n                ans.add(seen[k-1]);\n            }\n        }else{\n            k = 0;\n            seen.insert(0,nums[i]);\n        }\n    }\n    return ans;\n\n  }\n}\n```
['Python', 'C++', 'Java', 'JavaScript', 'C#', 'Dart']