Tree Sets
You are given a tree with $N$ nodes. A non-empty set $S$ of nodes is called good if the following condition holds: - There exists some node $x$ in the tree, such that: - For every pair $(y, z)$ with $y \ne z$, and $y, z \in S$, it is true that $x$ lies on the path from $y$ to $z$ (possibly $x = y$ or $x = z$). Note that $x$ may be chosen from outside the set $S$ itself. Count the number o
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