摘要:
```c++ Node *flatten(Node *head) { Node *it = head; stack stack1; while (it) { if (it->child) { stack1.push(it->next); it->next = it->child; ... 阅读全文
摘要:
```c++
ListNode *reverse(ListNode *head) { ListNode *front = head, *rear = nullptr, *temp = nullptr; while (front != nullptr) { temp = front->next; front->next = rear; ... 阅读全文
摘要:
自己写的不够简洁 阅读全文
摘要:
```c++ ListNode *insertionSortList(ListNode *head) { if (head == nullptr || head->next == nullptr) return head; auto *prehead = new ListNode(0), *front = prehead; prehead->next = h... 阅读全文
摘要:
方法一 活用set 方法二 快慢指针找中点然后反转后半部分链表,然后插入到前半个链表当中去 阅读全文
摘要:
```c++
TreeNode *BST(ListNode *begin, ListNode *end) { if (begin == end) return nullptr; ListNode *fast = begin, *slow = begin; while (fast->next != end) { fast = fast->nex... 阅读全文