Easy way to solve beat 100%
IntuitionApproachComplexity
Time complexity:

Space complexity:
Code
# Intuition
<!-- Describe your first thoughts on how to solve this problem. -->

# Approach
<!-- Describe your approach to solving the problem. -->

# Complexity
- Time complexity:
<!-- Add your time complexity here, e.g. $$O(n)$$ -->

- Space complexity:
<!-- Add your space complexity here, e.g. $$O(n)$$ -->

# Code
```cpp []
class LUPrefix {
public:
    LUPrefix(int n) {
        
    }
    
      void upload(int video) {
        uploadedVideos.insert(video);

        while (uploadedVideos.count(longestSequence + 1)) {
            ++longestSequence;
        }
    }

    int longest() {
        return longestSequence;
    }

private:
    int longestSequence = 0;
    unordered_set<int> uploadedVideos;
};

/**
 * Your LUPrefix object will be instantiated and called as such:
 * LUPrefix* obj = new LUPrefix(n);
 * obj->upload(video);
 * int param_2 = obj->longest();
 */
```
['C++']