c++ simple solution
The idea is that after one video has been uploaded, it will never be removed, which means the logested prefix keeps growing and we can simply track the  by a si
The idea is that after one video has been uploaded, it will never be removed, which means the logested prefix keeps growing and we can simply track the  by a single variable. (The intuition here is very samilar to sliding window)\nAnd since the simple variable will move from 0 to n. We know the time complixity is actually O(n). The solution is good enough and no need for any other fancy data structure. \nCode below \n```\nclass LUPrefix {\npublic:\n    vector<int> data; \n    int s = 0; \n    LUPrefix(int n) {\n        data.resize(n);\n    }\n    \n    void upload(int i) {\n        data[i-1] = 1; \n    }\n    \n    int longest() {\n        while(s<data.size()&&data[s]) {\n            s++;\n        }\n        return s; \n    }\n};\n\n/**\n * Your LUPrefix object will be instantiated and called as such:\n * LUPrefix* obj = new LUPrefix(n);\n * obj->upload(video);\n * int param_2 = obj->longest();\n */\n ```
[]