Back to problems

Implement deleteDirectory with getChildrenPaths and deleteFile APIs

Object-Oriented Programming · Google · Medium

You are working with a filesystem abstraction that exposes these operations: List getChildrenPaths(String path): returns every immediate child of path; each returned path can identify either a file or a directory. For an empty directory, the result is an empty list. void deleteFile(String path): removes the file at path; assume the supplied path identifies a file, and deleting a directory through this method may fail. Implement the following operation: void…

Checking your access…