/** * so easy * @param list1 * @param list2 * @return */ public ListNode Merge(ListNode list1, ListNode list2) { ListNode cur1 = list1; ListNode cur2 = list2; ListNode node = new ListNode(0); ListNode cur = node; while (cur1 != null && cur2 != null) { if (cur1.val < cur2.val) { cur.next = cur1; cur1 = cur1.next; } else { cur.next = cur2; cur2 = cur2.next; } cur = cur.next; } while (cur1 != null) { cur.next = cur1; cur = cur.next; cur1 = cur1.next; } while (cur2 != null) { cur.next = cur2; cur = cur.next; cur2 = cur2.next; } return node.next; }