simple and clean solution using vector<bool>
\nclass LUPrefix {\npublic:\n    vector<bool> v;\n    int a=1;\n    int b;\n    LUPrefix(int n) {\n        v.resize(n+1,false);\n        b=n;\n    }\n    \n    
```\nclass LUPrefix {\npublic:\n    vector<bool> v;\n    int a=1;\n    int b;\n    LUPrefix(int n) {\n        v.resize(n+1,false);\n        b=n;\n    }\n    \n    void upload(int video) {\n        v[video]=true;\n    }\n    \n    int longest() {\n        while(a<=b)\n        {\n            if(v[a]==false)break;\n            a++;\n        }\n        return a-1;\n        \n    }\n};\n\n```
[]