随笔分类 - online judge:LeetCode--链表
摘要:/** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode(int x) : val(x), next(NULL) {} * }; */ class Solu
阅读全文
摘要:#include using namespace std; struct ListNode { int val; ListNode *next; ListNode(int x) : val(x), next(NULL) {} }; class Solution { public: ListNode* reverseBetween(ListNode* head...
阅读全文
摘要:142. Linked List Cycle II 142. Linked List Cycle II Given a linked list, return the node where the cycle begins. If there is no cycle, return null. To
阅读全文
摘要:141. Linked List Cycle 141. Linked List Cycle Given a linked list, determine if it has a cycle in it. To represent a cycle in the given linked list, w
阅读全文
摘要: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 may not modify the values in the list's nod
阅读全文
摘要:148. Sort List 148. Sort List Sort a linked list in O(n log n) time using constant space complexity. Example 1: Input: 4->2->1->3 Output: 1->2->3->4 E
阅读全文