Company: Namma yatri_12april
Difficulty: medium
Directory Structure (SDE Question) - Part A Problem Description A file explorer stores its directories as a tree. Every directory may contain any number of child directories, and the names of the children of one directory are all different. The tree has exactly one top directory, called the root , which has no parent. The path of a directory is the chain of names from the root down to it, joined by / . In the tree root |-- a | |-- d | +-- e |-- b +-- c |-- f +-- g the paths are root , root/a , root/a/d , root/a/e , root/b , root/c , root/c/f and root/c/g . A path is valid only if it names a directory that exists in the tree at the moment the command is executed. Paths change as directories are moved and copied, so a path that was valid earlier may stop being valid later, and the other way round. You are given the initial tree and a list of commands. Execute the commands in order and print one line of output for each of them. The three commands countDescendants <path> Print how ma