C# Solution || Easy Solution
Complexity\n- Time complexity:\nRemove => O(1), Seat => O(N)\n- Space complexity:\nO(N)\n# Code\n\npublic class ExamRoom {\n    SortedSet<int> reserved;\n    in
# Complexity\n- Time complexity:\nRemove => O(1), Seat => O(N)\n- Space complexity:\nO(N)\n# Code\n```\npublic class ExamRoom {\n    SortedSet<int> reserved;\n    int N;\n    public ExamRoom(int n) {\n        reserved = new SortedSet<int>();\n        N = n - 1;\n    } \n    public int Seat() {  \n        int cur = 0, dis = 0;\n        var seats = reserved.ToList();\n        if(seats.Count > 0) dis = seats[0];\n        for(int i = 1; i < seats.Count;i++)\n        {\n            int diff = seats[i] - seats[i - 1];\n            int mid = (diff / 2) + seats[i - 1];\n            if(mid -  seats[i - 1] > dis){\n                cur = mid;\n                dis = mid - seats[i - 1];\n            }\n        }\n        if(seats.Count > 0 && N - seats[seats.Count - 1] > dis)\n            cur = N;\n        reserved.Add(cur);\n        return cur;\n    }\n    \n    public void Leave(int p) {\n        reserved.Remove(p);\n    }\n}\n\n```
['Ordered Set', 'C#']