Python clean
\n# N2. Longest Uploaded Prefix\nclass LUPrefix:\n    def __init__(self, n: int):\n        self.arr = [0] * (n + 2)\n        self.ans = 0\n\n    def upload(self
```\n# N2. Longest Uploaded Prefix\nclass LUPrefix:\n    def __init__(self, n: int):\n        self.arr = [0] * (n + 2)\n        self.ans = 0\n\n    def upload(self, video: int) -> None:\n        self.arr[video] = 1\n\n    def longest(self) -> int:\n        # answer only grows up, by 1\n        while self.arr[self.ans + 1]:\n            self.ans += 1\n        return self.ans\n```
[]