Code
Loading editor...
Tap Analyze to see visualization
Click Analyze to visualize
See step-by-step execution, variables, and output
Variables
Run code to see variables
Output
Console output will appear here
Click Analyze to visualize
See step-by-step execution, variables, and output
Run code to see variables
Console output will appear here
For BST, both keys below go left, both above go right; otherwise current node is LCA.
BST ordering guarantees the split of target nodes into left or right partitions.
Updated Feb 2026