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