[LeetCode] 328. Odd Even Linked List

2019-01-14
阅读 1 分钟
1.7k
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.

[LeetCode] 876. Middle of the Linked List

2018-12-31
阅读 2 分钟
1.9k
Given a non-empty, singly linked list with head node head, return a middle node of linked list.

[LeetCode] 61. Rotate List

2018-12-30
阅读 2 分钟
1.7k
Given a linked list, rotate the list to the right by k places, where k is non-negative.

[LeetCode] 445. Add Two Numbers II

2018-12-05
阅读 2 分钟
1.4k
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.

[LeetCode] 86. Partition List

2018-12-02
阅读 1 分钟
2k
Given a linked list and a value x, partition it such that all nodes less than x come before nodes greater than or equal to x.

[LeetCode] 708. Insert into a Cyclic Sorted List

2018-11-26
阅读 3 分钟
4.4k
Given a node from a cyclic linked list which is sorted in ascending order, write a function to insert a value into the list such that it remains a cyclic sorted list. The given node can be a reference to any single node in the list, and may not be necessarily the smallest value in the cyclic list.

[LeetCode] 430. Flatten a Multilevel Doubly Linked List

2018-11-26
阅读 2 分钟
3.5k
You are given a doubly linked list which in addition to the next and previous pointers, it could have a child pointer, which may or may not point to a separate doubly linked list. These child lists may have one or more children of their own, and so on, to produce a multilevel data structure, as s...

[LeetCode] 109. Convert Sorted List to Binary Search Tree

2018-11-15
阅读 1 分钟
2.6k
Given a singly linked list where elements are sorted in ascending order, convert it to a height balanced BST.

[LeetCode] 143. Reorder List

2018-10-01
阅读 2 分钟
1.5k
Given a singly linked list L: L0→L1→…→Ln-1→Ln,reorder it to: L0→Ln→L1→Ln-1→L2→Ln-2→…

[LeetCode] 148. Sort List

2018-10-01
阅读 2 分钟
1.5k
Sort a linked list in O(n log n) time using constant space complexity.

[LeetCode] Plus One Linked List

2018-08-19
阅读 1 分钟
1.7k
Given a non-negative integer represented as non-empty a singly linked list of digits, plus one to the integer.

[LeetCode/LintCode] Odd Even Linked List

2018-07-16
阅读 1 分钟
1.2k
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.

[LeetCode] Two Sum IV - Input is a BST

2018-05-13
阅读 1 分钟
2k
Given a Binary Search Tree and a target number, return true if there exist two elements in the BST such that their sum is equal to the given target.

[LintCode] Insert into a Cyclic Sorted List

2018-01-01
阅读 2 分钟
1.7k
Given a node from a cyclic linked list which has been sorted, write a function to insert a value into the list such that it remains a cyclic sorted list. The given node can be any single node in the list. Return the inserted new node.

[LintCode] Insert Node in Sorted Linked List

2017-12-29
阅读 2 分钟
2k
Problem Insert a node in a sorted linked list. Example Given list = 1->4->6->8 and val = 5. Return 1->4->5->6->8. Solution {代码...}

[LintCode] Implement Stack (using ListNode)

2017-12-29
阅读 1 分钟
2.3k
Implement a stack. You can use any data structure inside a stack except stack itself to implement it.

[LintCode] Add Two Numbers II

2017-12-19
阅读 2 分钟
1.3k
You have two numbers represented by a linked list, where each node contains a single digit. The digits are stored in forward order, such that the 1's digit is at the head of the list. Write a function that adds the two numbers and returns the sum as a linked list.

【LC总结】翻转链表 Swap in Pairs, Reverse in k-Group, Reverse LinkedList

2016-10-20
阅读 3 分钟
2.3k
For example,Given 1->2->3->4, you should return the list as 2->1->4->3.

[LeetCode] Reverse Linked List I & II

2016-10-20
阅读 2 分钟
1.9k
Head loop through the list: Store head.next, head points to tail, tail becomes head, head goes to stored head.next;

[LintCode] Swap Two Nodes in Linked List

2016-09-15
阅读 2 分钟
2.1k
Given a linked list and two values v1 and v2. Swap the two nodes in the linked list with values v1 and v2. It's guaranteed there is no duplicate values in the linked list. If v1 or v2 does not exist in the given linked list, do nothing.

[LintCode/LeetCode] LRU Cache

2016-07-10
阅读 6 分钟
3.3k
Design and implement a data structure for Least Recently Used (LRU) cache. It should support the following operations: get and set.

[LeetCode] Remove LinkedList Elements

2016-06-02
阅读 2 分钟
2.1k
Remove all elements from a linked list of integers that have value val.

[LintCode/LeetCode] Partition List

2016-04-28
阅读 2 分钟
2k
Given a linked list and a value x, partition it such that all nodes less than x come before nodes greater than or equal to x.

[LintCode] Reorder List [链表综合题型]

2016-04-28
阅读 2 分钟
2.5k
Given 1->2->3->4->null, reorder it to 1->4->2->3->null.

[LintCode] Sort List [分治]

2016-04-28
阅读 2 分钟
1.9k
Sort a linked list in O(n log n) time using constant space complexity.

[LintCode/LeetCode] Convert Sorted List to Balanced BST [二叉搜索树]

2016-04-28
阅读 1 分钟
3.1k
Given a singly linked list where elements are sorted in ascending order, convert it to a height balanced BST.

[LintCode/LeetCode] Copy List with Random Pointer [链表复制与分离]

2016-04-27
阅读 2 分钟
2.6k
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.

[LintCode] Merge K Sorted Lists [DC/Heap]

2016-04-27
阅读 3 分钟
2.8k
Problem Merge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity. Example Given lists: {代码...} return -1->2->4->null. Note 分治做法中,merge()函数依然是将链表结点两两进行比较,然后在sort()函数中迭代merge两个二分后sort()的结果。PriorityQueue更为...

[LintCode] Remove Duplicates form Sorted List I & II

2016-04-17
阅读 2 分钟
1.9k
Given a sorted linked list, delete all duplicates such that each element appear only once.

[LintCode/LeetCode] Merge Two Sorted Lists

2016-04-03
阅读 1 分钟
1.9k
Merge two sorted (ascending) linked lists and return it as a new sorted list. The new sorted list should be made by splicing together the nodes of the two lists and sorted in ascending order.