Easy solution | C++
solution 1:\n\nclass LUPrefix {\npublic:\n    int len = 1, a[100001] = {0};\n    LUPrefix(int n) {}\n    void upload(int video) {\n        a[video] = 1;\n      
**solution 1:**\n```\nclass LUPrefix {\npublic:\n    int len = 1, a[100001] = {0};\n    LUPrefix(int n) {}\n    void upload(int video) {\n        a[video] = 1;\n        while(a[len])++len;\n    }\n    \n    int longest() {\n        return len-1;\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```\n**solution 2:**\n```\nclass LUPrefix {\npublic:\n    set<int> s;\n    LUPrefix(int n) {\n        for (int i=1; i<=n+1; i++) s.insert(i);\n    }\n    \n    void upload(int video) {\n        s.erase(video);\n    }\n    int longest() {\n        return *s.begin()-1;\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```
[]