← All problemsSign in

The Spooky Tree

A spooky tree consisting of $N$ nodes is present. Each node has a scariness value. The scariness rating of a node is the product of scariness value of that node and depth of that node. The scariness rating of a tree is the sum of scariness rating of all nodes. i.e. scariness rating of tree = $\sum_{i=1} ^{\N}$($ScarinessValue [i]$) * ($depth[i]$). You have not yet decided which node should be the

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.

voice by Sarvam AI

Sign in to chat with the tutor and save your progress.

Sign in to start