python solution faster 90%
class LUPrefix:\n\n    def init(self, n: int):\n        self.arr = [False] * n\n        self.minTrue = -1\n        \n\n    def upload(self, video: int) -> None:
class LUPrefix:\n\n    def __init__(self, n: int):\n        self.arr = [False] * n\n        self.minTrue = -1\n        \n\n    def upload(self, video: int) -> None:\n        video -= 1\n        self.arr[video] = True\n        if self.minTrue == video - 1:\n            while video + 1 < len(self.arr) and self.arr[video + 1]:\n                video += 1\n            self.minTrue = video\n            \n        \n    def longest(self) -> int:\n        \n        return self.minTrue + 1
['Python']