Easy Solution
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```csharp []\npublic class Solution {\n    public IList<int> LastVisitedIntegers(int[] nums) {\n        List<int> a=new List<int>();\n        List<int> b=new List<int>();\n        int k=0;\n        for(int i=0;i<nums.Length;i++)\n        {\n            if(nums[i]!=-1)\n            {\n                k=0;\n                a.Insert(0,nums[i]);\n            }\n            else\n            {\n                k++;\n                if(a.Count>=k) \n                {\n                    b.Add(a[k-1]);\n                }\n                else \n                {\n                    b.Add(-1);\n                }\n            }\n        }\n        return b;\n    }\n}\n```
['C#']