Skip to content

Commit 98375c1

Browse files
committed
Fixed compile warnings.
1 parent e3e65b2 commit 98375c1

File tree

3 files changed

+18
-9
lines changed

3 files changed

+18
-9
lines changed

src/main/kotlin/g0001_0100/s0021_merge_two_sorted_lists/Solution.kt

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,19 @@ package g0001_0100.s0021_merge_two_sorted_lists
66

77
import com_github_leetcode.ListNode
88

9+
/*
10+
* Example:
11+
* var li = ListNode(5)
12+
* var v = li.`val`
13+
* Definition for singly-linked list.
14+
* class ListNode(var `val`: Int) {
15+
* var next: ListNode? = null
16+
* }
17+
*/
918
class Solution {
10-
fun mergeTwoLists(l1: ListNode?, l2: ListNode?): ListNode? {
11-
var l1 = l1
12-
var l2 = l2
19+
fun mergeTwoLists(list1: ListNode?, list2: ListNode?): ListNode? {
20+
var l1 = list1
21+
var l2 = list2
1322
var list: ListNode? = ListNode(-1)
1423
val head = list
1524
while (l1 != null || l2 != null) {

src/main/kotlin/g0001_0100/s0023_merge_k_sorted_lists/Solution.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import com_github_leetcode.ListNode
77

88
class Solution {
99
fun mergeKLists(lists: Array<ListNode>): ListNode? {
10-
return if (lists.size == 0) {
10+
return if (lists.isEmpty()) {
1111
null
1212
} else mergeKLists(lists, 0, lists.size)
1313
}
@@ -23,9 +23,9 @@ class Solution {
2323
}
2424
}
2525

26-
private fun mergeTwoLists(left: ListNode?, right: ListNode?): ListNode? {
27-
var left = left
28-
var right = right
26+
private fun mergeTwoLists(leftLocal: ListNode?, rightLocal: ListNode?): ListNode? {
27+
var left = leftLocal
28+
var right = rightLocal
2929
if (left == null) {
3030
return right
3131
}

src/main/kotlin/g0001_0100/s0024_swap_nodes_in_pairs/Solution.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ class Solution {
1414
return reverse(head, len)
1515
}
1616

17-
private fun getLength(curr: ListNode): Int {
18-
var curr: ListNode? = curr
17+
private fun getLength(currLocal: ListNode): Int {
18+
var curr: ListNode? = currLocal
1919
var cnt = 0
2020
while (curr != null) {
2121
cnt++

0 commit comments

Comments
 (0)