← All problemsSign in

Avengers vs Thanos

$Tony Stark$ daughter $Morgan Stark$ has been kidnapped by $Thanos$. $Avengers$ are trying to rescue her.The path to reach $Morgan$ is in the form of a tree having N nodes and each node has a value. The tree is rooted at 1. The nodes with prime value might have bombs. Hence $Avengers $ wants to know how many nodes have prime value in the subtree of a certain node(including that node itself). The v

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