Python Easy Solution
\nclass LUPrefix:\n\n    def __init__(self, n: int) -> None:\n        \n        self.uploaded = set()\n        self.prefix = list(range(n, -1, -1))\n        \n 
```\nclass LUPrefix:\n\n    def __init__(self, n: int) -> None:\n        \n        self.uploaded = set()\n        self.prefix = list(range(n, -1, -1))\n        \n    def upload(self, video: int) -> None:\n        \n        self.uploaded.add(video - 1)\n\t\t\n        while self.prefix[-1] in self.uploaded:\n            self.prefix.pop()\n        \n    def longest(self) -> int:\n        \n        return self.prefix[-1]\n```
['Python']