Skip to content
This repository has been archived by the owner on May 3, 2024. It is now read-only.

LeetCode | Qiming's Blog #13

Open
xqm32 opened this issue Mar 4, 2022 · 0 comments
Open

LeetCode | Qiming's Blog #13

xqm32 opened this issue Mar 4, 2022 · 0 comments

Comments

@xqm32
Copy link
Owner

xqm32 commented Mar 4, 2022

https://xqm32.github.io/leetcode/

力扣每日一水。
2022.3.4 # # @lc app=leetcode.cn id=71 lang=python3 # # [71] 简化路径 # # @lc code=start class Solution: def simplifyPath(self, path: str) -> str: path = path.split('/') pwd = [] for i in path: match(i): case '' | '.': continue case '..': if len(pwd) == 0: continue else: pwd.pop() case _: pwd.append(i) return '/'+'/'.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant