
链表
Ber03
:)
展开
-
[LeetCode] 23. Merge k Sorted Lists
原题链接: https://leetcode.com/problems/merge-k-sorted-lists/相似题目:21. Merge Two Sorted Lists1. 题目介绍:Merge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity.合...原创 2019-05-01 17:20:09 · 207 阅读 · 0 评论 -
[LeetCode] 专题总结——链表刷题指南
1. 基本介绍链表是一种根据元素逻辑结果排列起来的数据结构,和数组比较像。但是这两者的区别在于,数组的长度是固定的,而链表的长度是不确定的。在现实情况中,需要保存的元素长度往往是不固定的,此时就可以使用链表进行存储。在每个节点中,主要保存的属性是数据(data)和下一个节点的引用(next)。在进行链表操作的时候,首先需要的是一个根节点(第一个节点即为根节点),然后每一个节点的引用都保存在上...原创 2019-04-28 13:44:40 · 1123 阅读 · 0 评论 -
[LeetCode] 138. Copy List with Random Pointer
原题链接: https://leetcode.com/problems/copy-list-with-random-pointer/1. 题目介绍A linked list is given such that each node contains an additional random pointer which could point to any node in the list or...原创 2019-04-28 13:43:51 · 185 阅读 · 0 评论 -
[LeetCode] 430. Flatten a Multilevel Doubly Linked List
原题链接: https://leetcode.com/problems/flatten-a-multilevel-doubly-linked-list/1. 题目介绍You are given a doubly linked list which in addition to the next and previous pointers, it could have a child point...原创 2019-04-28 12:00:28 · 195 阅读 · 0 评论 -
[LeetCode] 707. Design Linked List
原题链接: https://leetcode.com/problems/design-linked-list/1. 题目介绍题目非常长,简单来说,需要我们设计并实现一个链表类。什么是链表类呢?Design your implementation of the linked list. You can choose to use the singly linked list or the d...原创 2019-04-28 00:33:41 · 178 阅读 · 0 评论 -
[LeetCode] 876. Middle of the Linked List
原题链接: https://leetcode.com/problems/middle-of-the-linked-list/1. 题目介绍Given a non-empty, singly linked list with head node head, return a middle node of linked list. If there are two middle nodes, re...原创 2019-04-24 22:12:49 · 188 阅读 · 0 评论 -
[LeetCode] 1019. Next Greater Node In Linked List
原题链接: https://leetcode.com/problems/next-greater-node-in-linked-list/1. 题目介绍We are given a linked list with head as the first node. Let’s number the nodes in the list: node_1, node_2, node_3, … etc...原创 2019-04-23 22:43:07 · 301 阅读 · 0 评论 -
[Leetcode] 25. Reverse Nodes in k-Group
原题链接: https://leetcode.com/problems/reverse-nodes-in-k-group/1. 题目介绍Given a linked list, reverse the nodes of a linked list k at a time and return its modified list.k is a positive integer and is l...原创 2019-04-22 20:11:32 · 133 阅读 · 0 评论 -
[LeetCode] 817. Linked List Components
原题链接: https://leetcode.com/problems/linked-list-components/1. 题目介绍We are given head, the head node of a linked list containing unique integer values.We are also given the list G, a subset of the va...原创 2019-04-21 14:25:29 · 228 阅读 · 0 评论 -
[LeetCode] 328. Odd Even Linked List
原题链接: https://leetcode.com/problems/odd-even-linked-list/1. 题目介绍Given a singly linked list, group all odd nodes together followed by the even nodes. Please note here we are talking about the node nu...原创 2019-04-21 01:11:14 · 137 阅读 · 0 评论 -
[LeetCode] 234. Palindrome Linked List
原题链接: https://leetcode.com/problems/palindrome-linked-list/1. 题目介绍Given a singly linked list, determine if it is a palindrome.判断一个链表是不是回文串。Example 1:Input: 1->2Output: falseExample 2:Input...原创 2019-04-19 20:02:24 · 168 阅读 · 0 评论 -
[LeetCode] 160. Intersection of Two Linked Lists
原题链接: https://leetcode.com/problems/intersection-of-two-linked-lists/1. 题目介绍Write a program to find the node at which the intersection of two singly linked lists begins.For example, the following t...原创 2019-04-18 22:25:51 · 171 阅读 · 0 评论 -
[LeetCode] 147. Insertion Sort List
原题链接: https://leetcode.com/problems/insertion-sort-list/1. 题目介绍Sort a linked list using insertion sort.A graphical example of insertion sort. The partial sorted list (black) initially contains only...原创 2019-04-17 17:36:40 · 143 阅读 · 0 评论 -
[LeetCode] 725. Split Linked List in Parts
原题链接:https://leetcode.com/problems/split-linked-list-in-parts/1. 题目介绍Given a (singly) linked list with head node root, write a function to split the linked list into k consecutive linked list “parts...原创 2019-04-16 22:51:33 · 200 阅读 · 0 评论 -
[LeetCode] 148. Sort List
原题链接: https://leetcode.com/problems/sort-list/1. 题目介绍Sort a linked list in O(n log n) time using constant space complexity.使用常数级的空间复杂度 和 O(n log n) 的时间复杂度为一个链表排序。Example 1:Input: 4->2->1-&g...原创 2019-04-15 22:20:38 · 171 阅读 · 0 评论 -
[LeetCode] 109. Convert Sorted List to Binary Search Tree
原题链接: https://leetcode.com/problems/convert-sorted-list-to-binary-search-tree/1. 题目介绍Given a singly linked list where elements are sorted in ascending order, convert it to a height balanced BST.For...原创 2019-04-14 22:33:46 · 186 阅读 · 0 评论 -
[LeetCode] 143. Reorder List
原题链接: https://leetcode.com/problems/reorder-list/1. 题目介绍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 nodes, only ...原创 2019-04-13 23:26:43 · 183 阅读 · 0 评论 -
[LeetCode] 142. Linked List Cycle II
原题链接:https://leetcode.com/problems/linked-list-cycle-ii/1. 题目介绍Given a linked list, return the node where the cycle begins. If there is no cycle, return null.To represent a cycle in the given linke...原创 2019-04-13 00:24:13 · 139 阅读 · 0 评论 -
[LeetCode] 92. Reverse Linked List II
原题链接:1. 题目介绍Reverse a linked list from position m to n. Do it in one-pass.Note: 1 ≤ m ≤ n ≤ length of list.给出一个链表,以及数字 m、n。反转 [m , n ] 部分的链表。使用一次循环。1 ≤ m ≤ n ≤ length length 是链表的长度Example:Inpu...原创 2019-04-11 22:22:44 · 137 阅读 · 0 评论 -
[LeetCode] 86. Partition List
原题链接:https://leetcode.com/problems/partition-list/1. 题目介绍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.You should pres...原创 2019-04-10 20:54:19 · 146 阅读 · 0 评论 -
[LeetCode] 61. Rotate List
原题链接: https://leetcode.com/problems/rotate-list/1. 题目介绍Given a linked list, rotate the list to the right by k places, where k is non-negative.给出一个链表,向右循环链表 k 位,k是一个非负整数。Example 1:Input: 1->2-&...原创 2019-04-09 17:55:56 · 133 阅读 · 0 评论 -
[LeetCode] 445. Add Two Numbers II
原题链接: https://leetcode.com/problems/add-two-numbers-ii/1. 题目介绍You are given two non-empty linked lists representing two non-negative integers. The most significant digit comes first and each of thei...原创 2019-04-08 20:55:54 · 145 阅读 · 0 评论 -
[LeetCode] 206. Reverse Linked List
原题链接: https://leetcode.com/problems/reverse-linked-list/1. 题目介绍Reverse a singly linked list.反转一个单向链表。Example:Input: 1->2->3->4->5->NULLOutput: 5->4->3->2->1->NULL...原创 2019-04-08 00:16:20 · 196 阅读 · 0 评论 -
[LeetCode] 82. Remove Duplicates from Sorted List II
原题链接: https://leetcode.com/problems/remove-duplicates-from-sorted-list-ii/原创 2019-04-07 00:48:42 · 141 阅读 · 0 评论 -
[LeetCode] 141. Linked List Cycle
原题链接: https://leetcode.com/problems/linked-list-cycle/1. 题目介绍Given a linked list, determine if it has a cycle in it.To represent a cycle in the given linked list, we use an integer pos which repres...原创 2019-04-05 23:01:32 · 494 阅读 · 0 评论 -
[LeetCode] 203. Remove Linked List Elements
原题链接: https://leetcode.com/problems/remove-linked-list-elements/1. 题目介绍Remove all elements from a linked list of integers that have value val.给定一个链表,删除所有元素值为 val 的节点。Example:Input: 1->2->6...原创 2019-04-03 11:42:16 · 239 阅读 · 0 评论 -
[LeetCode] 24. Swap Nodes in Pairs
原题链接: https://leetcode.com/problems/swap-nodes-in-pairs/1. 题目介绍Given a linked list, swap every two adjacent nodes and return its head.You may not modify the values in the list’s nodes, only nodes i...原创 2019-04-02 16:06:06 · 133 阅读 · 0 评论 -
[LeetCode] 2. Add Two Numbers
原题链接:https://leetcode.com/problems/add-two-numbers/1. 题目介绍You are given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse order and each of their no...原创 2019-04-01 16:33:20 · 166 阅读 · 0 评论 -
[LeetCode] 83. Remove Duplicates from Sorted List
原题链接:https://leetcode.com/problems/remove-duplicates-from-sorted-list/1. 题目介绍Given a sorted linked list, delete all duplicates such that each element appear only once.给出一个已经有序链表,删除链表中的重复元素。Example...原创 2019-03-31 15:17:22 · 163 阅读 · 0 评论 -
[LeetCode] 21. Merge Two Sorted Lists
原题链接: https://leetcode.com/problems/merge-two-sorted-lists/1. 题目介绍Merge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of the first t...原创 2019-03-29 23:15:22 · 173 阅读 · 0 评论 -
[LeetCode] 237. Delete Node in a Linked List
原题链接: https://leetcode.com/problems/delete-node-in-a-linked-list/1. 题目介绍Write a function to delete a node (except the tail) in a singly linked list, given only access to that node.Given linked list...原创 2019-03-29 17:22:44 · 158 阅读 · 0 评论 -
[LeetCode] 19. Remove Nth Node From End of List
原题链接: https://leetcode.com/problems/remove-nth-node-from-end-of-list/1. 题目介绍Given a linked list, remove the n-th node from the end of list and return its head.给定一个链表,删除倒数第 n 个元素,然后返回新链表的头指针Example...原创 2019-03-29 17:07:33 · 244 阅读 · 0 评论