We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 555f558 commit a4473c8Copy full SHA for a4473c8
merge-two-sorted-lists/hwanmini.js
@@ -1,3 +1,4 @@
1
+// m: list1, n: list2
2
// 시간복잡도: O(m + n)
3
// 공간복잡도: O(m + n)
4
@@ -19,10 +20,10 @@ var mergeTwoLists = function(list1, list2) {
19
20
21
while (list1 && list2) {
22
if (list1.val < list2.val) {
- res.next = new ListNode(list1.val);
23
+ res.next = list1
24
list1 = list1.next;
25
} else {
- res.next = new ListNode(list2.val);
26
+ res.next = list2
27
list2 = list2.next;
28
}
29
0 commit comments