Easiest Solution Ever C++
\nclass LUPrefix {\n    vector<int> ds;\n    int count = 1;\n    int len;\npublic:\n    LUPrefix(int n) {\n        len = n;\n        ds = vector<int>(n+1);\n   
```\nclass LUPrefix {\n    vector<int> ds;\n    int count = 1;\n    int len;\npublic:\n    LUPrefix(int n) {\n        len = n;\n        ds = vector<int>(n+1);\n    }\n    \n    void upload(int video) \n    {\n        if(video == count)\n        {\n            ds[video]++;\n            count++;\n            video++;\n            while(video <= len and ds[video] != 0){count++;video++;}\n        }\n        else\n        {\n            ds[video]++;\n            \n        }\n    }\n    \n    int longest() \n    {\n        if(count == 1)return 0;\n        return count-1;\n        \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```
['C', 'C++']