/**
class Solution {
public:
ListNode* mergeTwoLists(ListNode* l1, ListNode* l2) {
if (l1 == nullptr) {
return l2;
} else if (l2 == nullptr) {
return l1;
} else if (l1->val < l2->val) {
l1->next = mergeTwoLists(l1->next, l2);
return l1;
} else {
l2->next = mergeTwoLists(l1, l2->next);
return l2;
}
}
};
(本人是数据结构小白)根据答案显示是这样,我现在想要初始化两个值为124,134的链表,然后使用此函数该怎么做?谢谢
leetcode中不是有测试用例吗?将你的124,134放进去。就可以再leetcode上验证了