Most Easy and Short solution + Meme
Self explanatory solution\n\n\nclass LUPrefix {\n    Set<Integer> set;\n    int max=0;\n    public LUPrefix(int n) {\n        set=new HashSet<>();\n    }\n    p
**Self explanatory solution**\n\n```\nclass LUPrefix {\n    Set<Integer> set;\n    int max=0;\n    public LUPrefix(int n) {\n        set=new HashSet<>();\n    }\n    public void upload(int video) {\n        set.add(video);\n        while(set.contains(max+1)) max++;\n    }\n    public int longest() {\n        return max;\n    }\n}\n```\n\nmeme :\n\n![image](https://assets.leetcode.com/users/images/fd1666c2-d394-428e-8928-efa9dfc134bb_1664639992.3392522.jpeg)\n\n***let\'s connect :***\n\n\uD83D\uDE80 [www.linkedin.com/in/harshitmaurya](https://www.linkedin.com/in/harshitmaurya/)\n\uD83D\uDE80 [twitter.com/HarshitMaurya_](https://twitter.com/HarshitMaurya_)\n\n\n\n
['Ordered Set', 'Java']