(beats 95% for time) Segment tree
Intuition\nwe can check for the left child and update the parent node on the basis of the left child if the left child dont have the node True the irrespective 
# Intuition\nwe can check for the left child and update the parent node on the basis of the left child if the left child dont have the node True the irrespective of the length of the right child and if the left child has a prefix value we can simply add the left and right child for parent value.\n\n# Approach\nSegment tree query updates.\n\n# Complexity\n- Time complexity:\nO(nlogn)\n\n- Space complexity:\no(n)\n\n# Code\n```cpp []\n\nclass LUPrefix {\npublic:\n    vector<int> t;\n    vector<int> a;\n    int k;\n    LUPrefix(int n) {\n        std::ios_base::sync_with_stdio(false);\n        std::cin.tie(nullptr);\n        std::cout.tie(nullptr);\n        k = n;\n        t.resize(4*n,0);\n        a.resize(n,0);\n        tree(0,k-1,0);\n    }\n    \n    void upload(int video) {\n        a[video - 1] = 1;\n        int v = video-1;\n        update(0, 0,k-1,v);\n    }\n    \n    int longest() {\n        return t[0];\n    }\n\n private:\n    void update(int ind , int tl , int tr, int pos)\n    {\n        if(tl == tr)\n        {\n            t[ind] = 1;\n            return;\n        }\n        int tm = (tl+tr)/2;\n\n        if(pos<=tm)\n        {\n            update(ind*2+1,tl,tm,pos);\n        }\n        else\n        {\n            update(ind*2+2,tm+1,tr,pos);\n        }\n        t[ind] = comb(t[2*ind+1],t[2*ind+2],tm,tl,tr);\n    }\n\n    int comb(int l, int r, int mid ,int tl, int tr)\n    {\n        if(l == mid-tl+1)\n        {\n            return l+r;\n        }\n        else\n        {\n            return l;\n        }\n    }\n    void tree(int tl,int tr,int ind)\n    {\n        if(tl == tr)\n        {\n            t[ind] = a[tl];\n        }\n        else\n        {\n            int tm = (tl+tr)/2;\n            tree(tl,tm,2*ind+1);\n            tree(tm+1,tr,2*ind+2);\n            t[ind] = comb(t[2 * ind + 1], t[2 * ind + 2], tm,tl, tr);\n        }\n    }\n};\n\n```
['Segment Tree', 'C++']