Company: Intuit_6march
Difficulty: medium
You're maintaining a file system laid out as a tree of n folders, and you'll process q operations against it. Each operation is one of three kinds: mkdir <folder-x> <folder-y> : Create a folder named <folder-y> under <folder-x>. rmdir <folder-x> : Delete <folder-x> from the system, including its subdirectories. count_subdir <folder-x> : Compute the total number of folders (possibly immediate or non-immediate) under <folder-x> (including itself) and return the count. Return an array holding the results of every count_subdir operation, listed in the same order those operations occurred. Note: "folder-1" is always the root directory, and no query will call for it to be removed. Example Suppose existingStructureEdges = [["folder-1", "a"], ["folder-1", "b"], ["folder-1", "c"], ["a", "d"], ["a", "e"], ["e", "f"], ["c", "g"]] and queries = ["mkdir d h", "rmdir e", "count_subdir a"] Command No. Command Action Result 1 mkdir d h Create new directo