LeetCode 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 to... Read More

# Tag Archives: 快慢指针

# LeetCode Odd Even Linked List

LeetCode Odd Even Linked List Given a singly linked list, group all odd nodes together followed by the even nodes. Please note here we are talking about the node number and not the value in the nodes. You should try to do it in place. The program... Read More

# LeetCode Find the Duplicate Number

LeetCode Find the Duplicate Number Given an array nums containing n + 1 integers where each integer is between 1 and n (inclusive), prove that at least one duplicate number must exist. Assume that there is only one duplicate number, find the duplicate... Read More

# LeetCode Linked List Cycle II

LeetCode 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. Follow up: Can you solve it without using extra space? 本题在LeetCode Linked List... Read More

# LeetCode Linked List Cycle

LeetCode Linked List Cycle Given a linked list, determine if it has a cycle in it. Follow up: Can you solve it without using extra... Read More

# LeetCode Palindrome Linked List

LeetCode Palindrome Linked List Given a singly linked list, determine if it is a palindrome. Follow up: Could you do it in O(n) time and O(1) space? 本题要判断一个单向链表是否为回文链表。之前LeetCode Valid... Read More

# LeetCode Convert Sorted List to Binary Search Tree

LeetCode Convert Sorted List to Binary Search Tree Given a singly linked list where elements are sorted in ascending order, convert it to a height balanced BST. 这一题和之前的LeetCode Convert Sorted Array to Binary Search... Read More

# LeetCode Rotate List

LeetCode Rotate List Given a list, rotate the list to the right by k places, where k is non-negative. For example: Given 1->2->3->4->5->NULL and k = 2, return... Read More

# LeetCode Remove Nth Node From End of List

LeetCode Remove Nth Node From End of List Given a linked list, remove the nth node from the end of list and return its head. For example, Given linked list: 1->2->3->4->5, and n = 2. After removing the second node from the end, the... Read More