Roger and Tree II
CodeChefOpen on judge ↗
Roger was having fun solving his problems until he found this one.As you know, an undirected connected graph with N nodes and N-1 edges is called a tree. You are given an integer 'K' and a tree consisting of 'N' nodes. Each node 'i' has a value a(i) associated with it. We call a path 'P' of tree valid if following conditions are satisfied: - P has atleast 2 nodes associated with it. - Max a(u)
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