Skip to content

Commit 1fefda7

Browse files
authored
Add files via upload
1 parent 142c2f5 commit 1fefda7

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

Daily Challenge/71. Simplify Path/71. Simplify Path.md

Whitespace-only changes.
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
class Solution:
2+
def simplifyPath(self, path: str) -> str:
3+
path = path.split('/')
4+
print(path)
5+
stack = []
6+
for c in path:
7+
if c:
8+
if c == '.':
9+
continue
10+
elif c == '..':
11+
if stack:
12+
stack.pop()
13+
else:
14+
continue
15+
else:
16+
stack.append(c)
17+
18+
19+
return '/'+'/'.join(stack)

0 commit comments

Comments
 (0)