How would you like to learn today?
Visualize algorithms in real time, explore them step by step, or challenge yourself with a test.Choose a path to focus—or scroll down to preview all options.
Visualize the algorithm step-by-step with interactive animations in real time.
Read the full explanation, examples, and starter code at your own pace.
Drag and arrange the algorithm steps in the correct execution order.
🧠 Select Active to activate
Follow every state change, comparison, and transformation as the execution unfolds in real time.
📖 Select Passive to activate
A school has multiple classes of students, and each class will have a final exam. Your task is to distribute a given number of extra brilliant students across these classes to maximize the average pass ratio. Here's how it works:
You are given:
classes:A 2D array where each entry is of the form classes[i] = [passi, totali]:
passi: The number of students in the class who are guaranteed to pass.totali: The total number of students in the class.extraStudents:An integer representing the number of extra students you can assign to any class. These students are guaranteed to pass in the class they're assigned to.
extraStudents in a way that maximizes the average pass ratio across all classes.Input: classes = [[1, 2], [3, 5], [2, 2]];
extraStudents = 2;
Output: 0.78333;
Input:
classes = [[2, 4], [3, 9], [4, 5], [2, 10]]
extraStudents = 4
Output:
0.53485
🎯 Select Challenge to activate
Drag and arrange the algorithm steps in the correct execution order instead of spending time typing code letter by letter.
The algorithm is divided into three logical parts. Carefully rearrange each section in the correct order to form a complete and valid solution.
Understand Below AlgorithmGreen text means the instruction is placed in the correct position.
Red text means the instruction is in the wrong position.
Instructions with the same background color indicate particular blocks start and end.
A tick mark means the instruction is correct and locked.
🔒 Locked steps cannot be moved. Only unlocked steps are draggable.
🔊 Enable sound for swap feedback and completion effects.