Workspace File System With Folders and Tables
Problem statement
Model a workspace containing folders and table items.
CREATE_FOLDER pathrecursively creates missing folders and returns whether no table blocks the path.CREATE_TABLE pathcreates a table when its parent folder exists and the path is unused.LIST pathreturns direct children sorted as comma-separatedF:nameandT:name.DELETE pathremoves a table, or a folder and all nested folders and tables. Root cannot be deleted.
Return one string per operation.
Function
runWorkspaceFileSystem(operations: String[][]) → String[]Examples
Example 1
operations = [["CREATE_FOLDER","/sales/2026"],["CREATE_TABLE","/sales/2026/q1"],["LIST","/sales/2026"],["DELETE","/sales"],["LIST","/"]]return = ["true","true","T:q1","true",""]Folder creation is recursive and deletion cascades through the table.
Example 2
operations = [["CREATE_FOLDER","/b"],["CREATE_FOLDER","/a"],["CREATE_TABLE","/z"],["LIST","/"]]return = ["true","true","true","F:a,F:b,T:z"]Direct children are typed and sorted.
Constraints
1 <= operations.length <= 10000- Paths are normalized absolute paths.
- Each path is either a folder or a table, never both.