Java&JS&TS Solution (JW)
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```java []\npublic List<Integer> lastVisitedIntegers(int[] nums) {\n    LinkedList<Integer> seen = new LinkedList<>(); // Used for efficient prepending\n    List<Integer> ans = new ArrayList<>();\n    int consecutiveNegativeCount = 0;\n\n    for (int num : nums) {\n        if (num > 0) {\n            // Positive integer: prepend to seen and reset consecutive negatives count\n            seen.addFirst(num);\n            consecutiveNegativeCount = 0;\n        } else if (num == -1) {\n            // Negative integer: handle consecutive negatives\n            consecutiveNegativeCount++;\n            if (consecutiveNegativeCount <= seen.size()) {\n                ans.add(seen.get(consecutiveNegativeCount - 1));\n            } else {\n                ans.add(-1);\n            }\n        }\n    }\n\n    return ans;\n}\n```\n```javascript []\nvar lastVisitedIntegers = function(nums) {\n    const seen = []; // Array to store "seen" positive integers\n    const ans = [];  // Array to store the result\n    let consecutiveNegativeCount = 0;\n\n    for (let num of nums) {\n        if (num > 0) {\n            // If the number is positive, prepend it to `seen` and reset the counter\n            seen.unshift(num);\n            consecutiveNegativeCount = 0;\n        } else if (num === -1) {\n            // Handle consecutive -1s\n            consecutiveNegativeCount++;\n            if (consecutiveNegativeCount <= seen.length) {\n                ans.push(seen[consecutiveNegativeCount - 1]);\n            } else {\n                ans.push(-1);\n            }\n        }\n    }\n\n    return ans;\n};\n```\n```typescript []\nfunction lastVisitedIntegers(nums: number[]): number[] {\n    const seen: number[] = []; // Array to track "seen" positive integers\n    const ans: number[] = []; // Array to store the result\n    let consecutiveNegativeCount = 0;\n\n    for (const num of nums) {\n        if (num > 0) {\n            // If positive, prepend to `seen` and reset the counter\n            seen.unshift(num);\n            consecutiveNegativeCount = 0;\n        } else if (num === -1) {\n            // Handle consecutive -1s\n            consecutiveNegativeCount++;\n            if (consecutiveNegativeCount <= seen.length) {\n                ans.push(seen[consecutiveNegativeCount - 1]);\n            } else {\n                ans.push(-1);\n            }\n        }\n    }\n\n    return ans;\n};\n```
['Array', 'Simulation', 'Java', 'TypeScript', 'JavaScript']