返回首页
简化路径
LeetCode 经典 150
栈
难度:
中等
题目描述
简化 Unix 风格绝对路径。
解题思路
使用栈处理路径部分,遇到 ".." 弹出栈顶,遇到有效路径部分则入栈,最后拼接结果。