Simple Solution Using MinPriorityQueue 
IntuitionApproachComplexity
Time complexity:

Space complexity:
Code
# 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```javascript []\n/**\n\n * @param {number[][]} classes\n\n * @param {number} extraStudents\n\n * @return {number}\n\n */\n\nconst maxAverageRatio = (classes, extraStudents) => {\n\n    const pq = new MinPriorityQueue({priority: ([avg, pass, total]) => {\n        const new_avg = (pass + 1) / (total + 1);\n        return avg - new_avg;\n    }});\n    \n    let total_avg = 0;\n    for(const [pass, total] of classes) {\n        \n        const avg = pass / total;\n        pq.enqueue([avg, pass, total]);\n        total_avg += avg;\n        \n    }\n\n    while(extraStudents--) {\n        let [min_avg, min_pass, min_total] = pq.dequeue().element;\n\n        total_avg -= min_avg;\n        ++min_pass;\n        ++min_total;\n\n        const avg = min_pass / min_total;\n        pq.enqueue([avg, min_pass, min_total]);\n        \n        total_avg += avg;\n    }\n\n    return total_avg / classes.length;\n\n};\n```
['Array', 'Greedy', 'Heap (Priority Queue)', 'JavaScript']