摘要: 1 class Solution { 2 public: 3 ListNode* mergeTwoLists(ListNode* l1, ListNode* l2) { 4 ListNode* head = new ListNode(0); 5 ListNode* res = head; 6 whi 阅读全文
posted @ 2016-03-10 21:10 co0oder 阅读(113) 评论(0) 推荐(0) 编辑
摘要: 1 class Solution { 2 public: 3 int length(ListNode* head){ 4 ListNode* tmp = head; 5 int len = 0; 6 while(tmp != NULL){ 7 ++ len; 8 tmp = tmp->next; 9 阅读全文
posted @ 2016-03-10 21:01 co0oder 阅读(509) 评论(0) 推荐(0) 编辑
摘要: 1 class Solution { 2 public: 3 void deleteNode(ListNode* node) { 4 if(node == NULL || node->next == NULL){ 5 node = NULL; 6 return; 7 } 8 ListNode* tm 阅读全文
posted @ 2016-03-10 20:13 co0oder 阅读(125) 评论(0) 推荐(0) 编辑