FastPrepWorkspace File System With Folders and Tables

Workspace File System With Folders and Tables

Clay logoClay● MediumFULLTIMEPHONE SCREEN
Learn

Problem statement

Model a workspace containing folders and table items.

  • CREATE_FOLDER path recursively creates missing folders and returns whether no table blocks the path.
  • CREATE_TABLE path creates a table when its parent folder exists and the path is unused.
  • LIST path returns direct children sorted as comma-separated F:name and T:name.
  • DELETE path removes 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.

More Clay problems

See Clay hiring insights
public String[] runWorkspaceFileSystem(String[][] operations) {
  // Write your code here.
}
operations[["CREATE_FOLDER","/sales/2026"],["CREATE_TABLE","/sales/2026/q1"],["LIST","/sales/2026"],["DELETE","/sales"],["LIST","/"]]
expected["true", "true", "T:q1", "true", ""]
Checking account…