← Questions
Remove deleted folders and their descendants from a path list
0
I was asked this
No reports yet. Sign in to say where you were asked it.
You get a list of hierarchical paths such as California, California/San Francisco and California/San Francisco/7th Street, and a list of paths to delete. Deleting a path removes it and everything under it. Return the paths that remain.
A trie keyed by path segment is a natural fit. Make sure a deleted path does not remove a sibling that only shares a prefix of characters (for example California/San versus California/San Francisco).
No official answer yet. Write yours on the right and run it.
Nothing published yet.
Sign in to submit your code; every attempt is kept here.
Write and test your solution herePython in your browser, the question's tests level by level, every submission kept for you.Sign in to start coding
