| 일 | 월 | 화 | 수 | 목 | 금 | 토 | 
|---|---|---|---|---|---|---|
| 1 | ||||||
| 2 | 3 | 4 | 5 | 6 | 7 | 8 | 
| 9 | 10 | 11 | 12 | 13 | 14 | 15 | 
| 16 | 17 | 18 | 19 | 20 | 21 | 22 | 
| 23 | 24 | 25 | 26 | 27 | 28 | 29 | 
| 30 | 
													Tags
													
											
												
												- English
 - 화상영어
 - 10분
 - 영어원서읽기
 - 운동
 - 프로젝트
 - 미드시청
 - 사이드
 - 파비최
 - 쓰릴오브파이트
 - 3줄정리
 - Daily Challenge
 - FIT XR
 - 만화도
 - 링피트
 - 30분
 - realclass
 - 영어공부
 - 스탭퍼
 - Writing
 - 괜찮음
 - leetcode
 - 매일
 - 개발자
 - 읽기
 - 뭐든
 - 잡생각
 - 리얼 클래스
 - 월간
 - Problem Solving
 
													Archives
													
											
												
												- Today
 
- Total
 
파비의 매일매일 공부기록
2023.04.12 Today's Challenge 본문
https://leetcode.com/problems/simplify-path/
Simplify Path - LeetCode
Can you solve this real interview question? Simplify Path - Given a string path, which is an absolute path (starting with a slash '/') to a file or directory in a Unix-style file system, convert it to the simplified canonical path. In a Unix-style file sys
leetcode.com
3일째 스택 관련 문제!
class Solution:
    def simplifyPath(self, path: str) -> str:
        st = []
        path = path.split('/')
        for p in path:
            if st and p == '..':
                st.pop()
            elif p not in ['.', '', '..']:
                st.append(p)
        return '/' + '/'.join(st)반응형
    
    
    
  'Problem Solving > LeetCode' 카테고리의 다른 글
| 2023.04.14 Today's Challenge (0) | 2023.04.14 | 
|---|---|
| 2023.04.13 Today's Challenge (0) | 2023.04.13 | 
| 2023.04.11 Today's Challenge (0) | 2023.04.11 | 
| 2023.04.10 Today's Challenge (0) | 2023.04.10 | 
| 2023.04.09 Today's Challenge (0) | 2023.04.09 | 
			  Comments