ServiceNow | 4th feb 2024 | File Structure
ServiceNow · Question · Posted Apr 2026
Problem Breakdown: File Structure You are given an initial directory structure represented as a tree with n nodes. You must process q queries and return the results for all "Type 3" queries. Query Types mkdir <folder-x> <folder-y>: Create a new folder named folder-y as a child of folder-x. rmdir <folder-x>: Delete folder-x and all its descendants from the tree. count_subdir <folder-x>: Calculate the total number of folders in the subtree rooted at folder-x (including folder-x itself). Key Constraints & Notes ...
The full answer & interview discussion are available to premium members.
Log in Create a free account