# \*1429. First Unique Number

[https://leetcode.com/problems/first-unique-number/](https://leetcode.com/problems/first-unique-number/)

## solution

```python
class FirstUnique:
    def __init__(self, nums: List[int]):
        self.counter = Counter(nums)
        self.queue = deque(nums)

    def showFirstUnique(self) -> int:
        while self.queue and self.counter[self.queue[0]] != 1:
            self.queue.popleft()
        return -1 if not self.queue else self.queue[0]

    def add(self, value: int) -> None:
        self.counter[value] += 1
        self.queue.append(value)
```

时间复杂度：O()\
空间复杂度：O()
