Java TreeSet Solution
class Solution {\n\n    public int[] closestRoom(int[][] rooms, int[][] queries) {\n\n        //rooms sort is room size\n        //queries append index (result[
class Solution {\n\n    public int[] closestRoom(int[][] rooms, int[][] queries) {\n\n        //rooms sort is room size\n        //queries append index (result[i])\n        //queries sort is room size\n        \n        int row = queries.length;\n        int[] result = new int[queries.length];\n        \n        Arrays.sort(rooms, (a, b) -> b[1] - a[1]);        \n        \n        int[][] query = new int[row][3];\n        for(int i = 0; i < queries.length; i++) {\n            query[i][0] = queries[i][0];\n            query[i][1] = queries[i][1];\n            query[i][2] = i;\n        }\n        \n        //query sort room size\n        Arrays.sort(query, (a, b) -> b[1] - a[1]);                \n        int idx = 0;\n        TreeSet<Integer> set = new TreeSet<Integer>();\n        \n        for(int i = 0; i < query.length; i++) {\n            //room size > query room size => after room id check\n            while(idx < rooms.length && rooms[idx][1] >= query[i][1]) {\n                set.add(rooms[idx++][0]); \n            }\n\n            //treeMap idx (Binary Search)\n            Integer floor = set.floor(query[i][0]);\n            Integer ceil = set.ceiling(query[i][0]);\n            \n            if(floor == null && ceil == null ) result[query[i][2]] = -1; //not index\n            \n            else if(floor == null) result[query[i][2]] = ceil;\n            \n            else if(ceil == null) result[query[i][2]] = floor;\n            \n            else result[query[i][2]] = ceil - query[i][0] >= query[i][0] - floor ? floor : ceil;\n        }\n                \n    return result;\n    }\n}
['Tree', 'Ordered Set', 'Java']