일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
Tags
- DWG
- 프로그래머스
- Generator
- t1
- 715. Range Module
- iterator
- 315. Count of Smaller Numbers After Self
- Class
- 43. Multiply Strings
- Decorator
- Regular Expression
- 컴퓨터의 구조
- Substring with Concatenation of All Words
- Convert Sorted List to Binary Search Tree
- 운영체제
- Python
- LeetCode
- 109. Convert Sorted List to Binary Search Tree
- 시바견
- attribute
- 밴픽
- 파이썬
- concurrency
- Protocol
- data science
- Python Code
- Python Implementation
- shiba
- 30. Substring with Concatenation of All Words
- kaggle
Archives
- Today
- Total
목록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