c#, Sorted Set
Intuition\n Describe your first thoughts on how to solve this problem. \nWe can store unloaded chunks, so to compupute the prefix we should find the min unloade
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\nWe can store **unloaded** chunks, so to compupute the prefix we should find the min unloaded chunk.\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\nWe can use `SortedSet<int>` to store **unloaded** chunks\n\n# Complexity\n- Time complexity:\nO(N * log (N)) to initialize the instance\nO(log(N)) to add\nO(1) to query \n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\nO(N) \n# Code\n```\npublic class LUPrefix {\n    private SortedSet<int> m_Empty;\n\n    public LUPrefix(int n) {\n        m_Empty = new SortedSet<int>(Enumerable.Range(1, n + 1));\n    }\n    \n    public void Upload(int video) => m_Empty.Remove(video);    \n        \n    public int Longest() => m_Empty.Min - 1;\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```
['C#']