| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 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
- leetcode
- 30분
- 뭐든
- 괜찮음
- English
- 매일
- 개발자
- Daily Challenge
- 월간
- 파비최
- 잡생각
- 읽기
- 리얼 클래스
- 미드시청
- 화상영어
- realclass
- 스탭퍼
- Problem Solving
- 10분
- FIT XR
- 운동
- 쓰릴오브파이트
- 사이드
- 프로젝트
- 영어원서읽기
- Writing
- 만화도
- 영어공부
- 링피트
- 3줄정리
Archives
- Today
- Total
파비의 매일매일 공부기록
Today's Challenge 본문
https://leetcode.com/problems/partition-list/
Partition List - LeetCode
Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview.
leetcode.com
어제에 이어 또 리스트 문제
class Solution:
def partition(self, head: Optional[ListNode], x: int) -> Optional[ListNode]:
before = before_head = ListNode(0)
after = after_head = ListNode(0)
while head:
if head.val < x:
before.next = head
before = before.next
else:
after.next = head
after = after.next
head = head.next
after.next = None
before.next = after_head.next
return before_head.next반응형
'Problem Solving > LeetCode' 카테고리의 다른 글
| Today's Challenge (0) | 2022.07.24 |
|---|---|
| Today's Challenge (0) | 2022.07.23 |
| Today's Challenge (0) | 2022.07.21 |
| Today's Challenge (0) | 2022.07.20 |
| Today's Challenge (0) | 2022.07.19 |
Comments