Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit80c913c

Browse files
authored
Create 160-Intersection-of-Two-Linked-Lists.py
1 parent3fb2263 commit80c913c

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Definition for singly-linked list.
2+
# class ListNode:
3+
# def __init__(self, x):
4+
# self.val = x
5+
# self.next = None
6+
7+
classSolution:
8+
defgetIntersectionNode(self,headA:ListNode,headB:ListNode)->Optional[ListNode]:
9+
l1,l2=headA,headB
10+
whilel1!=l2:
11+
l1=l1.nextifl1elseheadB
12+
l2=l2.nextifl2elseheadA
13+
returnl1

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp