← All problems
Simplify Path (Unix)
Given an absolute Unix-style path, canonicalize it: resolve '.' and '..' components, collapse multiple slashes, and return the simplified canonical path. For example, '/a/./b/../../c/' becomes '/c'.
Complexity
Time O(n), Space O(n)
Common pitfalls
- Popping on '..' past root
- Keeping trailing slash
Your solution
Log in to save your code and track progress.