← All problemsSign in

Subtree Summation

Hinata needs your help in her homework. - You are given a tree with **N** vertices with **1** as root vertex. - You need to find the result of this equation. ![image](https://s3.amazonaws.com/hr-assets/0/1567300921-058e70c644-3.PNG) Here **f(x)** = sum of values of all the vertices in the subtree of **x** whose values are strictly less than value at vertex **x**. ###INPUT FORMAT: 1. In the fi

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