How would you like to learn today? Visualize algorithms in real time, explore them step by step through reading, or challenge yourself with a test.
Visualize the algorithm step-by-step with interactive animations. See exactly how the code executes in real time.
Read comprehensive problem explanation, reference links, and explore the code at your own pace.
Drag and arrange the algorithm steps in the correct execution order.
Design a system that stores numbers in "containers" (indexed slots) and supports two main operations:
1.change(index, number):
Set the container at the specified index to the given number. If a container already has a number, replace it with the new number.
-1.change(index, number), the system stores number at that index. If the container already held a number, it is replaced.find(number), the system searches for all containers containing that number and returns the smallest index among them. If none is found, it returns -1.Input:
["NumberContainers", "change", "change", "find", "change", "find"] [[], [2, 10], [5, 10], [10], [2, 20], [10]]
Expected Output:
[null, null, null, 2, null, 5]
Step-by-Step Explanation:
Initialization:
Operation: change(2, 10)
Operation: change(5, 10)
Operation: find(10)
2Operation: change(2, 20)
Operation: find(10)
5Input:
["NumberContainers", "change", "find", "change", "change", "find", "change", "find", "find"] [[], [3, 15], [15], [7, 15], [3, 20], [15], [7, 30], [15], [20]]
Expected Output:
[null, null, 3, null, null, 7, null, -1, 3]
Step-by-Step Explanation:
Initialization:
Operation: change(3, 15)
Operation: find(15)
3Operation: change(7, 15)
Operation: change(3, 20)
Operation: find(15)
7Operation: change(7, 30)
Operation: find(15)
-1Operation: find(20)
31 <= index, number <= 10^910^5 calls combined to the change and find operations.Loading component...
Follow every state change, comparison, and transformation as the execution unfolds in real time, so you understand not just the result, but the journey.
Follow every state change, comparison, and transformation as the execution unfolds in real time, so you understand not just the result, but the journey.
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.
© 2026 | Privacy Policy | About