C++  | Easy to Understand | Using Vector
\nclass LUPrefix {\npublic:\n    vector<int> v;\n    int maxi=1;\n    LUPrefix(int n) \n    {\n        v.resize(n+2, 0);  \n        v[0]=1;\n        maxi=1;\n  
```\nclass LUPrefix {\npublic:\n    vector<int> v;\n    int maxi=1;\n    LUPrefix(int n) \n    {\n        v.resize(n+2, 0);  \n        v[0]=1;\n        maxi=1;\n    }\n    \n    void upload(int video) \n    {\n        v[video]=1; \n        while(v[maxi])\n            maxi++;\n    }\n    \n    int longest() \n    {\n        return maxi-1;\n    }\n};\n```
['C']