Product of Diameters
Chef had a tree T with weighted nodes. One day he decided that he wants to have two trees instead of one. So, he removed one of the edges of T. The next day, he decided to have three trees instead of two. So, he removed one more edge from some of the trees he had. And so on. Every day, Chef was removing one, not yet removed edge, util he once got a forest, consisting of N single-node trees.
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