Back to problems

File System Deletion

Algorithm · Datadog · Medium

Use the supplied FileSystem API to inspect and remove entries in a tree-structured file system. A path can reference either a regular file or a directory, and directories may contain files and nested directories. Implement DeleteTree(path). The sample cases invoke the same operation as deleteAllFilesAndDir. The function should behave like rm -rf on the supplied path: If path is a file, delete it immediately. If path is a directory, recursively delete all contents first, then…

Checking your access…