Search
⌘K

Leetcode 1233. Remove Sub-Folders from the Filesystem

Given a list of absolute folder paths, return only the top-level folders by removing any path that is a subfolder of another. The core challenge is efficiently detecting when one path is a prefix followed by '/' of another (commonly solved with lexicographic sorting and prefix checks or a Trie).

Asked at:

Google

Google

Meta


Question Timeline

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

Late April, 2025

Meta

Staff

Early September, 2024

Google

Google

Mid-level

Given an array of strings 'words', remove each word from the array that is a prefix of another word

Comments

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