✅C++ | ✅Use Array | ✅Easy approach
\nclass LUPrefix {\npublic:\n    \n    vector<int> pre;\n    int val=0;\n    \n    LUPrefix(int n) \n    {\n        pre.resize(n+2, 0);\n    }\n    \n    void u
```\nclass LUPrefix {\npublic:\n    \n    vector<int> pre;\n    int val=0;\n    \n    LUPrefix(int n) \n    {\n        pre.resize(n+2, 0);\n    }\n    \n    void upload(int video) \n    {\n        pre[video] = 1;\n        \n    }\n    \n    int longest() \n    {\n        while(pre[val+1]==1)\n                val++;\n        \n        return val;\n    }\n};\n```
['Array', 'C', 'C++']