일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 | 31 |
Tags
- Regular Expression
- 밴픽
- shiba
- kaggle
- 315. Count of Smaller Numbers After Self
- t1
- Protocol
- 프로그래머스
- 715. Range Module
- 운영체제
- attribute
- Convert Sorted List to Binary Search Tree
- Generator
- DWG
- Class
- concurrency
- Substring with Concatenation of All Words
- Python
- Python Implementation
- 30. Substring with Concatenation of All Words
- LeetCode
- data science
- 43. Multiply Strings
- 파이썬
- 109. Convert Sorted List to Binary Search Tree
- 시바견
- 컴퓨터의 구조
- Python Code
- Decorator
- iterator
Archives
- Today
- Total
목록24. Swap Nodes in Pairs (1)
Scribbling
LeetCode: 24. Swap Nodes in Pairs
문제의 쉬운 version... 재귀를 이용해서 푸는 방법을 익혀두자. # Definition for singly-linked list. # class ListNode: # def __init__(self, val=0, next=None): # self.val = val # self.next = next class Solution: def swapPairs(self, head: Optional[ListNode]) -> Optional[ListNode]: k = 2 count, node = 0, head while node and count < k: node = node.next count += 1 if count < k: return head n..
Computer Science/Coding Test
2021. 8. 26. 20:18