template
文章平均质量分 55
baladeer
CV菜鸟
展开
-
148. Sort List 21. Merge Two Sorted Lists
很好的一个模板题,链表找中点(快慢指针)和merge。 /** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode(int x) : val(x), next(NULL) {} * }; */ clas原创 2018-01-08 14:00:26 · 115 阅读 · 0 评论 -
206. Reverse Linked List
/** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode(int x) : val(x), next(NULL) {} * }; */ class Solution { public: Li原创 2018-01-08 18:39:23 · 101 阅读 · 0 评论 -
143. Reorder List
Given a singly linked list L: L0→L1→…→Ln-1→Ln, reorder it to: L0→Ln→L1→Ln-1→L2→Ln-2→… You must do this in-place without altering the nodes' values. For example, Given {1,2,3,4}, reorder it t原创 2018-01-09 21:20:47 · 96 阅读 · 0 评论