C++ two pointer solution. exPlained
Intuition:\nMy first thought when solving this problem was to sort the rooms and queries based on their end times, and then traverse the sorted queries to find 
# Intuition:\nMy first thought when solving this problem was to sort the rooms and queries based on their end times, and then traverse the sorted queries to find the closest room.\n\nThe two pointers in this code are `i` and `j`. `i` is pointing to the current index in the `rooms` vector, while `j` is pointing to the current index in the `queries` vector.\n\n# Approach:\nTo solve this problem, I used a two-pointer approach. First, I sorted both the rooms and queries based on their end times so that I could traverse the sorted queries. Then, I used a set to store the start times of the rooms. I used a set because it allows for efficient searching and insertion. \n\nNext, I traversed the sorted queries and for each query, I used the set to find the closest room with a start time that is greater than or equal to the query\'s start time. If a room with the same start time as the query\'s exists, then that room is returned. Otherwise, I used binary search to find the closest room with a start time greater than the query\'s start time. If a room exists, then the closest room (to the query\'s start time) is returned. Otherwise, the query is returned with no room (-1). \n\n# Complexity:\n- Time complexity: O(nlog(n))\n- Space complexity: O(n)\n\n# Code\n```\n#pragma GCC optimize("Ofast","inline","fast-math","unroll-loops","no-stack-protector")\n#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native","f16c")\nstatic const auto fast = []() {ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); return 0; } ();\nclass Solution {\npublic:\n    vector<int> closestRoom(vector<vector<int>>& rooms, vector<vector<int>>& queries) {\n        int n = rooms.size(), m = queries.size();\n        vector<int> ans(m);\n        vector<vector<int>> q(m, vector<int>(3));\n        for (int i = 0; i < m; ++i) {\n            q[i][0] = queries[i][0], q[i][1] = queries[i][1], q[i][2] = i;\n        }\n        sort(rooms.begin(), rooms.end(), [](const auto& a, const auto& b) {\n            return a[1] > b[1];\n        });\n        sort(q.begin(), q.end(), [](const auto& a, const auto& b) {\n            return a[1] > b[1];\n        });\n        set<int> s;\n        int i = 0;\n        for (int j = 0; j < m; ++j) {\n            while (i < n && rooms[i][1] >= q[j][1]) {\n                s.insert(rooms[i++][0]);\n            }\n            auto it = s.lower_bound(q[j][0]);\n            if (it != s.end()) {\n                if (*it == q[j][0]) {\n                    ans[q[j][2]] = *it;\n                } else if (it != s.begin()) {\n                    ans[q[j][2]] = abs(*it - q[j][0]) < abs(*prev(it) - q[j][0]) ? *it : *prev(it);\n                } else {\n                    ans[q[j][2]] = *it;\n                }\n            } else if (it == s.end() && !s.empty()) {\n                ans[q[j][2]] = *prev(it);\n            } else {\n                ans[q[j][2]] = -1;\n            }\n        }\n        return ans;\n    }\n};\n```
['Array', 'Two Pointers', 'Binary Search', 'C++']