일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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
- 괜찮음
- 매일
- 읽기
- 사이드
- 미드시청
- 스탭퍼
- 운동
- 만화도
- Writing
- 영어원서읽기
- FIT XR
- 월간
- 쓰릴오브파이트
- Problem Solving
- 프로젝트
- 파비최
- 영어공부
- 개발자
- 링피트
- 뭐든
- 3줄정리
- 30분
- realclass
- 리얼 클래스
- 10분
- Daily Challenge
- 화상영어
- leetcode
- 잡생각
- English
Archives
- Today
- Total
파비의 매일매일 공부기록
Today's Challenge 본문
https://leetcode.com/problems/intersection-of-two-linked-lists/
Intersection of Two Linked Lists - 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
오예 Easy 난이도다 ㅎㅎ
근데 문제 설명이랑 풀이가 너무 상이해서.. 혼란이 왔음 ㅋㅋㅋ
class Solution:
def getIntersectionNode(self, headA: ListNode, headB: ListNode) -> Optional[ListNode]:
set_first = set()
curr = headA
while curr:
set_first.add(curr)
curr = curr.next
curr = headB
while curr:
if curr in set_first:
return curr
curr = curr.next
return None
반응형
'Problem Solving > LeetCode' 카테고리의 다른 글
Today's Challenge (0) | 2022.06.08 |
---|---|
Today's Challenge (0) | 2022.06.07 |
Today's Challenge (0) | 2022.06.05 |
Today's Challenge (0) | 2022.06.04 |
Today's Challenge (0) | 2022.06.03 |
Comments