JAVA solution | HashSet
Please Upvote !!! (\u25E0\u203F\u25E0)\n\nclass LUPrefix {\n    Set<Integer> set;\n    int maxConsecutiveVideo = 0;\n    \n    public LUPrefix(int n) {\n       
### ***Please Upvote !!!*** **(\u25E0\u203F\u25E0)**\n```\nclass LUPrefix {\n    Set<Integer> set;\n    int maxConsecutiveVideo = 0;\n    \n    public LUPrefix(int n) {\n        set = new HashSet<>();\n    }\n    \n    public void upload(int video) {\n        set.add(video);\n        while (set.contains(maxConsecutiveVideo + 1)) {\n            maxConsecutiveVideo++;\n        }\n    }\n    \n    public int longest() {\n        return maxConsecutiveVideo;\n    }\n}\n\n// TC: O(1), SC: O(n)\n```
['Java']