Delete Duplicate Folders

Solve a hard-level problem of deleting duplicate folders from a file system using tries.

Problem statement

A new file system doesn't allow duplicate directory structures. Two directories are said to have similar structures if they contain the same set of identical directories.

The file system has a duplicate checker that regularly identifies the directories with similar structures and marks them for deletion in the next cycle. The file system only runs the deletion once, so any folder that becomes identical after the initial deletion is not deleted.

Return the 2D array containing the paths of the remaining folders after deleting all the marked folders.


Sample input

Get hands-on with 1200+ tech skills courses.