A tale of two trees
CodeChefOpen on judge ↗
There are two trees; tree 1 has N1 nodes which are numbered from 1 to N1, and tree 2 has N2 nodes which are numbered from 1 to N2. Each tree is rooted at its node 1. You should perform the following operation: choose an arbitrary node u in tree 2, remove the subtree of node u (the subtree formed by node u and all its direct or indirect descendants) from tree 2 and add the subtree to any leaf of t
HINT LADDERno hints yet
L1 Observation
L2 Technique
L3 Approach
L4 Pseudo-code
🔒
L5 Full solution
L5 unlocks only if you insist twice
solution.cppC++17
CodeSearch Tutor
Hints, not spoilers — it won’t hand over the full solution unless you insist.
Sign in to chat with the tutor and save your progress.
Sign in to start