← All problemsSign in

Harini and her infinite rooted tree

When Harini gets bored, She sits down on the sofa, closes her eyes and thinks of an infinite rooted tree where each node has exactly N sons, at that for each node, the distance between it an its i-th left child equals to di. She also loves counting the number of nodes in the tree that are at a distance at most X from the root. The distance is the sum of the lengths of edges on the path between nod

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