摘要: Recorder 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 ... 阅读全文
posted @ 2016-01-18 19:16 Lewisr 阅读(200) 评论(0) 推荐(0)
摘要: Linked List Cycle II:Given a linked list, return the node where the cycle begins. If there is no cycle, return null. Note: Do not modify the linked list. 题意:对于给定的一个链表,判断其是否有环,如果有环的话,返回环开始的结点。 思路:在I中是判... 阅读全文
posted @ 2016-01-18 19:10 Lewisr 阅读(162) 评论(0) 推荐(0)
摘要: Reverse Linked List II: Reverse a linked list from position m to n. Do it in-place and in one-pass. For example:Given 1->2->3->4->5->NULL, m = 2 and n = 4, return 1->4->3->2->5->NULL. Note: Given m, n... 阅读全文
posted @ 2016-01-18 19:01 Lewisr 阅读(132) 评论(0) 推荐(0)