Datadog | Onsite | Rm -rf
Anonymous User
5626

Question was the following:

Assuming you have these functions:

  • Delete(path) -> bool: deletes the file or empty directory
  • IsDirectory(path) -> bool: checks whether filepath is directory or not
  • GetAllFiles(path) -> List<string>: gets the absolute paths of all files in a directory, including other directories

Implement rm -rf.
define DeleteAllFilesAndDir(path):

How do you code it in a way that prevents out of memory (OOM) errors?

Comments (13)