Simple straight forward soln, no conversion need || Understand through comments
IntuitionApproachComplexity
Time complexity:

Space complexity:
If u like my soln, upvote meCode
# Intuition
<!-- Describe your first thoughts on how to solve this problem. -->

# Approach
<!-- Describe your approach to solving the problem. -->

# Complexity
- Time complexity:
<!-- Add your time complexity here, e.g. $$O(n)$$ -->

- Space complexity:
<!-- Add your space complexity here, e.g. $$O(n)$$ -->
If u like my soln, upvote me
# Code
```cpp []
class Solution {
public:
    vector<int> lastVisitedIntegers(vector<int>& nums) {

        vector<int> seen;
        vector<int> ans;
        int count=0;

        for(int i=0;i<nums.size();i++){

            if(nums[i]>0){
                seen.insert(seen.begin(),nums[i]);//insert element to front and reset the count of -1's
                count=0;
            }else if(nums[i]== -1){
                count++;
                if(count<=seen.size()){
                    ans.push_back(seen[count-1]);//push the front element to ans and so on
                }else {
                    ans.push_back(-1);//if no +ve element left push -1
                }

            }
        }
        return ans;
        
    }
};
```
![d9a30a34-57a0-40f1-adab-43bec86a259a_1723795301.0363479.png](https://assets.leetcode.com/users/images/32a098f3-22b2-4172-b00d-51c113707596_1735910080.2845776.png)

['C++']