Search
⌘K

Leetcode 1948. Delete Duplicate Folders in System

Given a list of absolute folder paths, build the directory tree and delete every folder (and its entire subtree) whose subfolder structure and names are identical to some other folder’s, then return the remaining paths. The core challenge is to detect identical subtrees efficiently via canonical serialization/hashing and remove all duplicates in a single pass (no cascading deletions).


Question Timeline

See when this question was last asked and where, including any notes left by other candidates.

Comments

Your account is free and you can post anonymously if you choose.