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

Commitbeb0e1c

Browse files
authored
Create 1669-merge-in-between-linked-lists.py
1 parent18f3716 commitbeb0e1c

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
classSolution:
2+
defmergeInBetween(self,list1:ListNode,a:int,b:int,list2:ListNode)->ListNode:
3+
curr=list1
4+
i=0
5+
whilei<a-1:
6+
curr=curr.next
7+
i+=1
8+
9+
head=curr
10+
whilei<=b:
11+
curr=curr.next
12+
i+=1
13+
head.next=list2
14+
15+
whilelist2.next:
16+
list2=list2.next
17+
list2.next=curr
18+
returnlist1

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp