LeetCode编程练习 - Merge Two Sorted Lists学习心得
题目:
Merge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of the first two
lists.
合并两个有序的链表,并返回新链表,新链表应该有这两个链表的头部拼接而成。
思路:
查看解决方案,比较两个链表中的元素值,把较小的那个链表添加到新的链表中,若两个链表的长度不同,则直接将未完成的链表直接接入新链表的末尾。有一点是需要注意的,C#对首字母的大小写非常敏感,一般情况下“.”后面表示方法的首字母需要大写,但.next不需要,它表示只返回第一个字符。