Binary Tree General — Reasoning Check

Distinguish path contracts, traversal information, and target identity on new trees.


Get every question correct to pass this checkpoint. You can review feedback, revise your answers, and submit again.

1. A tree has root -20, left leaf 2, and right child 5 whose leaf children are 4 and 9. What is its maximum nonempty simple-path sum? Enter one integer.
2. Path Sum searches for target 3 in a tree with root 7 and leaf children -4 and 2. A proposed optimization stops whenever the running sum exceeds 3. What happens?

Select one answer.

3. Reconstruct the tree from preorder [11,5,2,8,17,13] and inorder [2,5,8,11,13,17]. What value is the left child of the root’s right child?
4. Tree A has root 2 with leaf children 1 and 3. Tree B is the right-child chain 1→2→3. A SameTree implementation compares only the two inorder value lists. What defect does this input expose?

Select one answer.

5. Root R has children A and B. A is a leaf with value 4. B has leaf children P (value 4) and Q (value 6). For target pointers P and Q, which LCA result satisfies the contract?

Select one answer.

6. For SumNumbers, root digit 0 has left child 3 and right leaf 2. Node 3 has leaf children 4 and 5. What sum is returned?
Join Discord