2424. Longest Uploaded Prefix
On This Page
class LUPrefix:
def __init__(self, n: int):
self.r = 0
self.s = set()
def upload(self, video: int) -> None:
self.s.add(video)
while self.r + 1 in self.s:
self.r += 1
def longest(self) -> int:
return self.r
# Your LUPrefix object will be instantiated and called as such:
# obj = LUPrefix(n)
# obj.upload(video)
# param_2 = obj.longest()