Easiest approach | C++ | Vector
\nclass LUPrefix {\npublic:\n    vector<int> arr;\n    int ptr = 0;\n    LUPrefix(int n) {\n        arr.resize(n, 0);\n    }\n    \n    void upload(int video) {
```\nclass LUPrefix {\npublic:\n    vector<int> arr;\n    int ptr = 0;\n    LUPrefix(int n) {\n        arr.resize(n, 0);\n    }\n    \n    void upload(int video) {\n        arr[video-1]++;\n    }\n    \n    int longest() {\n        while(ptr < arr.size() && arr[ptr] != 0)\n            ptr++;\n        return ptr;\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```
['Array', 'C', 'C++']