SumTree
CodeChefOpen on judge ↗
SumTree:- Problem Statement : -------------------------------- You are given a Tree rooted at index 1. Each edge of the tree have a weight associated with it. Cost of reaching a node is equal to sum of weights on its path from root. You need to find the sum of cost of each node. -------------------------------- Input Format : First line consist of N, i.e, number of Nodes i
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