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
You are given a contaminated binary tree where all TreeNode.val have been changed to -1. The tree follows these rules:
0.x, then:
2 * x + 1.2 * x + 2.Implement the FindElements class:
FindElements(TreeNode* root): Initializes the object with a contaminated binary tree and recovers it.bool find(int target): Returns true if the target value exists in the recovered binary tree, otherwise returns false.["FindElements","find","find"]
[[[-1]],[0],[1]]

[null,true,false]
FindElements findElements = new FindElements([-1]);
findElements.find(0); // returns True (root is always 0)
findElements.find(1); // returns False (no left or right child exists)
["FindElements","find","find","find","find","find"]
[[[-1,-1,-1,-1,-1,-1,-1]],[3],[5],[6],[7],[8]]

[null,true,true,true,false,false]
FindElements findElements = new FindElements([-1,-1,-1,-1,-1,-1,-1]);
findElements.find(3); // returns True
findElements.find(5); // returns True
findElements.find(6); // returns True
findElements.find(7); // returns False (no node with value 7 exists)
findElements.find(8); // returns False (no node with value 8 exists)
0.x, assign its left child 2 * x + 1 and right child 2 * x + 2.set or unordered_set for quick lookup.O(1) lookup in the find() function.🎯 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.