JAVA TreeSet Priority Queue Solution
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:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\n    public List<Integer> busiestServers(int k, int[] arrival, int[] load) {\n        int[] count = new int[k];\n        PriorityQueue<int[]> busy = new PriorityQueue<>((a,b) -> (a[1]-b[1]));\n        TreeSet<Integer> free = new TreeSet<>();\n        int busyValue = Integer.MIN_VALUE;\n\n        for(int i=0; i<k; i++)\n            free.add(i);\n\n        for(int i=0; i<arrival.length; i++) {\n            int start = arrival[i];\n            int end = start+load[i];\n\n            while(!busy.isEmpty() && busy.peek()[1]<=start)\n                free.add(busy.poll()[0]);\n\n            Integer server = free.ceiling(i%k);\n            if(server==null)\n                server = free.ceiling(0);\n\n            if(server==null)\n                continue;\n\n            free.remove(server);\n            busy.add(new int[]{server, end});\n            count[server]++;    \n            busyValue = Math.max(busyValue, count[server]);        \n        }    \n\n        List<Integer> result = new ArrayList<>();\n        for(int i=0; i<k; i++)\n            if(count[i] == busyValue)\n                result.add(i);\n\n        return result;        \n    }\n}\n\n\n/**\n1 req at a time\n[6,4,13]\n[1,1,1]\n */\n```
['Java']