[Python] Union-Find
When adding an element, it becomes a member of its own set. Then if a video behind it was uploaded, go ahead and union new set with the previous one. Similarly,
When adding an element, it becomes a member of its own set. Then if a video behind it was uploaded, go ahead and union new set with the previous one. Similarly, if there\'s another set right after it - merge these two, too.\n\n```\nclass LUPrefix:\n\n    def __init__(self, n: int):\n        self.uploaded = [0] * (n + 1)\n        self.n = n\n        \n    def upload(self, video: int) -> None:\n        self.uploaded[video] = video\n        if video == 1 or self.uploaded[video - 1] != 0:\n            self.uploaded[video - 1] = video\n        if video < self.n and self.uploaded[video + 1] != 0:\n            self.uploaded[video] = self.uploaded[video + 1]\n    \n    def _find(self, i):\n        if self.uploaded[i] == 0 or self.uploaded[i] == i:\n            return self.uploaded[i]\n        else:\n            self.uploaded[i] = self._find(self.uploaded[i])\n            return self.uploaded[i]\n\n    def longest(self) -> int:\n        return self._find(0)\n```\t
['Union Find', 'Python']