일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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
- kaggle
- 밴픽
- Python Code
- 시바견
- 컴퓨터의 구조
- 43. Multiply Strings
- Substring with Concatenation of All Words
- 프로그래머스
- 315. Count of Smaller Numbers After Self
- Decorator
- Regular Expression
- Generator
- t1
- Convert Sorted List to Binary Search Tree
- data science
- shiba
- DWG
- 파이썬
- concurrency
- 30. Substring with Concatenation of All Words
- Python Implementation
- Class
- Protocol
- 715. Range Module
- 109. Convert Sorted List to Binary Search Tree
- attribute
- Python
- LeetCode
- 운영체제
- iterator
Archives
- Today
- Total
목록160. Intersection of Two Linked Lists (1)
Scribbling
LeetCode: 160. Intersection of Two Linked Lists
O(1) Memory로 어떻게 풀지 고민해보았다. 방법은 두 List의 node 갯수를 파악하는 것이다. # Definition for singly-linked list. # class ListNode: # def __init__(self, x): # self.val = x # self.next = None class Solution: def getIntersectionNode(self, headA: ListNode, headB: ListNode) -> ListNode: m, n = 0, 0 cur = headA while cur != None: m += 1 cur = cur.next cur = headB while cur != None: n += 1 cur = cur.next if m >= n: for..
Computer Science/Coding Test
2021. 12. 2. 20:54