[Python3] Using List || O(1) amortized || 354ms || beats 100%
Here is a small trick with adding additional False to the list end like indicator of boundary. So we don\'t need to check the boundry in the while loop and got 
###### Here is a small trick with adding additional False to the list end like indicator of boundary. So we don\'t need to check the boundry in the while loop and got additional speed profit.\n`while self.videos[self.prefix]` instead of \n`while self.prefix < len(self.videos) and self.videos[self.prefix]`\n```python3 []\nclass LUPrefix:\n\n    def __init__(self, n: int):\n        self.videos = [False] * (n + 1)\n        self.prefix = 0\n\n    def upload(self, video: int) -> None:\n        self.videos[video-1] = True\n\n    def longest(self) -> int:\n        while self.videos[self.prefix]:\n            self.prefix += 1\n        return self.prefix\n```\n```python3 []\nclass LUPrefix:\n\n    def __init__(self, n: int):\n        self.videos = [False] * (n + 1)\n        self.prefix = 0\n\n    def upload(self, video: int) -> None:\n        self.videos[video-1] = True\n        while self.videos[self.prefix]:\n            self.prefix += 1\n\n    def longest(self) -> int:\n        return self.prefix\n```\n![Screenshot 2024-03-09 at 22.07.17.png](https://assets.leetcode.com/users/images/12684e4c-f8fe-4c32-b375-5c6973a1c9c5_1710011333.3775778.png)\nThis problem looks very similar to [ 1656. Design an Ordered Stream](https://leetcode.com/problems/design-an-ordered-stream/description/)
['Python', 'Python3']