simple code | streak method
\nunordered_map<int, int> mp;\n    LUPrefix(int n) {\n        for(int i=0;i<n;i++)\n            mp[i+1] = 0;\n    }\n    \n    void upload(int video) {\n       
```\nunordered_map<int, int> mp;\n    LUPrefix(int n) {\n        for(int i=0;i<n;i++)\n            mp[i+1] = 0;\n    }\n    \n    void upload(int video) {\n        int right = video + 1;\n        int left = video - 1;\n        int rightStreak = 0, leftStreak = 0;\n        \n        if(mp[right]!=0)\n            rightStreak = mp[right];\n        if(mp[left]!=0)\n            leftStreak = mp[left];\n        \n        int streak = leftStreak + rightStreak + 1;\n        mp[video] = streak;\n        mp[right + rightStreak - 1] = streak;\n        mp[left - leftStreak + 1] = streak;\n    }\n    \n    int longest() {\n        return mp[1];\n    }\n```
['C', 'Java']