← All problemsSign in

The Password

You are given a tree with $N$ nodes, rooted at $1$. Each node has a string associated with it. Every node has a $Password$ which has to be generated. The process to generate $Password$ is as follows: For every node, consider all strings which lie in the subtree of that node. Special Strings of the node are those whose frequency in the subtree is a prime number. Now for every letter from $a$

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