2424. Longest Uploaded Prefix
IntuitionApproachComplexity
Time complexity:

Space complexity:
Code
# 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)$$ -->

# Code
```python3 []
class LUPrefix:

    def __init__(self, n: int):
        self.uploaded = [False] * (n + 1)
        self.max_prefix = 0

    def upload(self, video: int):
        self.uploaded[video] = True
        while self.max_prefix + 1 <= len(self.uploaded) - 1 and self.uploaded[self.max_prefix + 1]:
            self.max_prefix += 1

    def longest(self) -> int:
        return self.max_prefix

```
['Python3']