Approach Summary
Split path by "/". Skip empty parts and ".". Pop stack for "..". Join remaining parts with "/".
How to Recognize This Pattern
- Canonical UNIX path — handle . and .. components
- Stack: push directories, pop on ".."
Complexity Analysis
Time Complexity
O(n)
Space Complexity
O(n)
Tags
String Stack