Code
The highlighted line runs next. The pill shows the live values in the running call.
Cost
Work done so far, and how the three solutions compare
The two trees
Positions are compared pair by pair
The highlighted line runs next. The pill shows the live values in the running call.
Work done so far, and how the three solutions compare
Positions are compared pair by pair
Keyboard: ← → step, Space play or pause. Enter the tree in level order with null for missing children, as LeetCode does (up to 10 nodes and 4 levels per tree, values −100 to 100). A dashed ∅ marks a missing child that is being compared with a real node (or with another missing one).