Is it a spruce
CodeChefOpen on judge ↗
Consider a rooted tree. A rooted tree has one special vertex called the root. All edges are directed from the root. Vertex $u$ is called a child of vertex $v$ and vertex $v$ is called a parent of vertex _u_ if there exists a directed edge from $v$ to $u$. A vertex is called a leaf if it doesn't have children and has a parent. Let's call rooted tree spruce if it's every non-leaf vertex has at
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