#C LinkedList and List! Runtime 62 ms Beats 100.00% Memory 48.34 MB Beats 18.75%
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```\npublic class Solution {\n    public IList<int> LastVisitedIntegers(int[] nums)\n    {\n        var seen = new LinkedList<int>();\n        var ans = new List<int>();\n        var k = 0;\n\n        for(int i = 0; i < nums.Length; i++)    \n        {\n            if(nums[i] != -1)\n            {\n                k = 0;\n                seen.AddFirst(nums[i]);\n            }\n            else\n            {\n                k++;\n                \n                if(k <= seen.Count)\n                    ans.Add(seen.ElementAt(k - 1));\n                else\n                    ans.Add(-1);\n            }\n        }\n\n        return ans;\n    }\n}\n```
['C#']