very easy solution ||C++||O(Nlogn)
Intuition\nWe will going to use set here because we know that set have element in sorted order\n\n# Approach\nnow i am going to describe my intution using a exa
# Intuition\nWe will going to use set here because we know that set have element in sorted order\n\n# Approach\nnow i am going to describe my intution using a example\nlet n=6;\nnow put all element from 1 to 6 in set\ns={1,2,3,4,5,6}\n\nnow when ever the function ***upload*** is called we gonna delete that element from set\nnow lets delete 3\nthen s={1,2,4,5,6}\nanswer will be 0\n\nnow delete 5\nthen s={1,2,4,6}\nanswer will be still 0 because 1 is still present in set\n\nnow delete 1\nthen s={2,4,6}\nanswer =1  \n\nnow delete 2\nthen s={4,6}\nanswer =3\n\n\n\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->Nlog(N)\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->O(N)\n\n# Code\n```\nclass LUPrefix {\npublic:\n    set<int>s;\n        int size;\n    LUPrefix(int n) {\n        for(int i=1;i<=n;i++)\n            s.insert(i);\n        \n        size=n;\n    }\n    \n    void upload(int video) {\n       s.erase(video); \n    }\n    \n    int longest() {\n        auto it=s.begin();\n        if(it==s.end())\n            return size;\n        \n        return *it-1;\n    }\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```
['Ordered Set', 'C++']