LeetCode Design Log Storage System You are given several logs that each log contains a unique id and timestamp. Timestamp is a string that has the following format: Year:Month:Day:Hour:Minute:Second, for example, 2017:01:01:23:59:59. All domains are... Read More

# Tag Archives: 链表

# LeetCode LRU Cache

LeetCode LRU Cache Design and implement a data structure for Least Recently Used (LRU) cache. It should support the following operations: get and put. get(key) - Get the value (will always be positive) of the key if the key exists in the cache,... Read More

# LeetCode Sort List

LeetCode Sort List Sort a linked list in O(n log n) time using constant space... Read More

# LeetCode Reorder List

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

# LeetCode Copy List with Random Pointer

LeetCode Copy List with Random Pointer A linked list is given such that each node contains an additional random pointer which could point to any node in the list or null. Return a deep copy of the... Read More

# LeetCode Insertion Sort List

LeetCode Insertion Sort List Sort a linked list using insertion... Read More

# LeetCode Intersection of Two Linked Lists

LeetCode Intersection of Two Linked Lists Write a program to find the node at which the intersection of two singly linked lists begins. For example, the following two linked lists: A: a1 → a2 ↘ c1... Read More

# LeetCode Flatten Binary Tree to Linked List

LeetCode Flatten Binary Tree to Linked List Given a binary tree, flatten it to a linked list in-place. For example, Given 1 / \ 2 5 / \ \ 3 4 6 The flattened tree should look like: 1 \ 2 ... Read More

# 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 Add Two Numbers II

LeetCode Add Two Numbers II You are given two non-empty linked lists representing two non-negative integers. The most significant digit comes first and each of their nodes contain a single digit. Add the two numbers and return it as a linked list. You... Read More