Java simple binary search beats 100%
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity: O(n*log(n))\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity: O(n*log(n))\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```java []\nclass Solution {\n    public int[] closestRoom(int[][] a, int[][] q) {\n        int n = q.length;\n        int[] res = new int[n];\n        int min = Arrays.stream(q).mapToInt(i -> i[1]).min().getAsInt();\n        List<int[]> a1 = new ArrayList<>();\n        Arrays.stream(a).filter(i -> i[1] >= min).forEach(i -> a1.add(i));\n        int m = a1.size();\n        a1.sort((i1, i2) -> i1[0] - i2[0]);\n        int[] b = a1.stream().mapToInt(i -> i[0]).toArray();\n        for (int i = 0; i < n; i++) {\n            int j = Arrays.binarySearch(b, q[i][0]);\n            if (j < 0) j = - (j + 1);\n            if (j == m) j--;\n            int l = j - 1, r = j;\n            while (l >= 0 && a1.get(l)[1] < q[i][1]) l--;\n            while (r >= 0 && r < m && a1.get(r)[1] < q[i][1]) r++;\n            if (l >= 0 && a1.get(l)[1] >= q[i][1] && (r == m || q[i][0] - b[l] <= b[r] - q[i][0])) {\n                res[i] = b[l];\n            }\n            else if (r >= 0 && r < m && a1.get(r)[1] >= q[i][1] && (l < 0 || q[i][0] - b[l] > b[r] - q[i][0])) {\n                res[i] = b[r];\n            }\n            else res[i] = -1;\n        }\n        return res;\n    }\n}\n```
['Array', 'Binary Search', 'Sorting', 'Java']