KING OF UNDERSTANDING
Intuitionby simple python funtionsApproachnormal brute force,basic opration of insert,append of in pythonComplexity
Time complexity:
O(n^2)
Space complexity:
O(
# Intuition
<!-- Describe your first thoughts on how to solve this problem. -->
by simple python funtions

# Approach
<!-- Describe your approach to solving the problem. -->
normal brute force,basic opration of insert,append of in python

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

- Space complexity:
<!-- Add your space complexity here, e.g. $$O(n)$$ -->
O(n)
# Code
```python []
class Solution(object):
    def lastVisitedIntegers(self, nums):
        seen = []
        ans = []
        maxi = 0

        for num in nums:
            if num != -1:
                seen.insert(0, num)
                maxi = 0
            else:
                maxi += 1
                if maxi <= len(seen):
                    ans.append(seen[maxi - 1])
                else:
                    ans.append(-1)

        return ans

```
['Python']