Simple Java solution
\nclass LUPrefix {\n    boolean[] videos;\n    int pointer = 0;\n    public LUPrefix(int n) {\n        videos = new boolean[n+1];\n    }\n    \n    public void 
```\nclass LUPrefix {\n    boolean[] videos;\n    int pointer = 0;\n    public LUPrefix(int n) {\n        videos = new boolean[n+1];\n    }\n    \n    public void upload(int video) {\n        videos[video] = true;\n    }\n    \n    public int longest() {\n        while(pointer < videos.length-1 && videos[pointer+1]) {\n            pointer++;\n        }\n        return pointer;\n    }\n}\n```
['Array', 'Java']