上一页 1 ··· 12 13 14 15 16 17 18 19 20 ··· 23 下一页
摘要: ```c++ ListNode *insertionSortList(ListNode *head) { if (head == nullptr || head->next == nullptr) return head; auto *prehead = new ListNode(0), *front = prehead; prehead->next = h... 阅读全文
posted @ 2019-01-12 17:40 INnoVation-V2 阅读(104) 评论(0) 推荐(0) 编辑
摘要: 方法一 活用set 方法二 快慢指针找中点然后反转后半部分链表,然后插入到前半个链表当中去 阅读全文
posted @ 2019-01-12 16:41 INnoVation-V2 阅读(173) 评论(0) 推荐(0) 编辑
摘要: ```c++ TreeNode *BST(ListNode *begin, ListNode *end) { if (begin == end) return nullptr; ListNode *fast = begin, *slow = begin; while (fast->next != end) { fast = fast->nex... 阅读全文
posted @ 2019-01-12 15:38 INnoVation-V2 阅读(99) 评论(0) 推荐(0) 编辑
摘要: ```c++ ListNode *removeElements(ListNode *head, int val) { if (head == nullptr) return head; auto *prehead = new ListNode(-1); prehead->next = head; hea... 阅读全文
posted @ 2018-12-25 21:59 INnoVation-V2 阅读(86) 评论(0) 推荐(0) 编辑
摘要: ```c++ ListNode *deleteDuplicates(ListNode *head) { if (head == nullptr || head->next == nullptr) return head; ListNode *temp = head; int save = temp->val; ... 阅读全文
posted @ 2018-12-25 19:57 INnoVation-V2 阅读(76) 评论(0) 推荐(0) 编辑
摘要: 61 旋转链表 一般解法 好一点解法 阅读全文
posted @ 2018-12-25 19:30 INnoVation-V2 阅读(92) 评论(0) 推荐(0) 编辑
摘要: ```c++ ListNode *swapPairs(ListNode *head) { if (head == nullptr || head->next == nullptr) return head; ListNode *it = head; head = head->next; it->next... 阅读全文
posted @ 2018-12-25 11:54 INnoVation-V2 阅读(132) 评论(0) 推荐(0) 编辑
摘要: 2.删除链表倒数第N个节点 普通方法 空间换时间(似乎没什么卵用) 阅读全文
posted @ 2018-12-25 01:44 INnoVation-V2 阅读(112) 评论(0) 推荐(0) 编辑
摘要: ```c++ ListNode *addTwoNumbers(ListNode *l1, ListNode *l2) { if (l1->next == nullptr && l1->val == 0) return l2; else if (l2->next == nullptr && l2->val == 0) ... 阅读全文
posted @ 2018-12-25 00:58 INnoVation-V2 阅读(118) 评论(0) 推荐(0) 编辑
摘要: 合并K个链表 暴力 善用vector 分治 阅读全文
posted @ 2018-12-24 23:20 INnoVation-V2 阅读(113) 评论(0) 推荐(0) 编辑
上一页 1 ··· 12 13 14 15 16 17 18 19 20 ··· 23 下一页