[Java] PriorityQueue Solution beats 100%
\npublic double maxAverageRatio(int[][] classes, int extraStudents) {\n\tQueue<double[]> pq = new PriorityQueue<>((a,b) -> {\n\t\tdouble ratioDiffA = (a[0] + 1)
```\npublic double maxAverageRatio(int[][] classes, int extraStudents) {\n\tQueue<double[]> pq = new PriorityQueue<>((a,b) -> {\n\t\tdouble ratioDiffA = (a[0] + 1) / (a[1] + 1) - a[0] / a[1];\n\t\tdouble ratioDiffB = (b[0] + 1) / (b[1] + 1) - b[0] / b[1];\n\t\treturn Double.compare(ratioDiffB, ratioDiffA);\n\t});\n\tfor (int[] c : classes) {\n\t\tpq.add(new double[]{c[0], c[1]});\n\t}\n\twhile (extraStudents-- > 0) {\n\t\tdouble[] c = pq.poll();\n\t\tc[0]++;\n\t\tc[1]++;\n\t\tpq.add(c);\n\t}\n\tdouble ratioSum = 0;\n\tfor (double[] c : pq) {\n\t\tratioSum += c[0] / c[1];\n\t}\n\treturn ratioSum / classes.length;\n}\n```
[]