[Java] Easy 100% solution
java\nclass LUPrefix {\n    private boolean[] videos;\n    private int maxIdx = 0;\n\n    public LUPrefix(int n) {\n        this.videos = new boolean[n + 1];\n 
```java\nclass LUPrefix {\n    private boolean[] videos;\n    private int maxIdx = 0;\n\n    public LUPrefix(int n) {\n        this.videos = new boolean[n + 1];\n    }\n    \n    public void upload(int video) {\n        this.videos[video] = true;\n\n        while(maxIdx < this.videos.length - 1 && videos[maxIdx + 1])\n            maxIdx++;\n    }\n    \n    public int longest() {\n        return maxIdx;\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```
['Java']