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

Commit1c4fa72

Browse files
authored
Create 1669-merge-in-between-linked-lists.kt
1 parent38d2104 commit1c4fa72

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
classSolution {
2+
funmergeInBetween(list1:ListNode?,a:Int,b:Int,list2:ListNode?):ListNode? {
3+
var curr= list1
4+
var i=0
5+
while (i< a-1) {
6+
curr= curr?.next
7+
i++
8+
}
9+
10+
var head= curr
11+
while (i<= b) {
12+
curr= curr?.next
13+
i++
14+
}
15+
head?.next= list2
16+
17+
var list2= list2
18+
while (list2?.next!=null)
19+
list2= list2?.next
20+
list2?.next= curr
21+
return list1
22+
}
23+
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp