题目1: Given a linked list, determine if it has a cycle in it. Follow up:Can you solve it without using extra space? 题目2: Given a linked list, return th ...
分类:
其他好文 时间:
2018-07-11 12:36:46
阅读次数:
131
Question "817.?Linked List Components " Solution 题目大意:给一个链表和该链表元素组成的一个子数组,求子数组在链表中组成多少个片段,每个片段中可有多个连续的元素 思路:构造一个set用来存储子数组元素用于判断是否存在,遍历链表,如果当前元素不存在而下一 ...
分类:
其他好文 时间:
2018-07-09 19:13:12
阅读次数:
162
链表(Linked list):是一种常见的基础数据结构,是一种线性表,但是并不会按线性的顺序存储数据,而是在每一个节点里存到下一个节点的指针(Pointer)。 使用链表结构可以克服数组链表需要预先知道数据大小的缺点,链表结构可以充分利用计算机内存空间,实现灵活的内存动态管理。但是链表失去了数组随 ...
分类:
其他好文 时间:
2018-07-09 19:07:54
阅读次数:
145
Your runtime beats 100.00 % of cpp submissions. ...
分类:
其他好文 时间:
2018-07-08 21:12:49
阅读次数:
169
Question "203.?Remove Linked List Elements" Solution 题目大意:从链表中删除给定的数 思路:遍历链表,如果该节点的值等于给的数就删除该节点,注意首节点 Java实现: ...
分类:
其他好文 时间:
2018-07-08 16:40:09
阅读次数:
118
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 less than or equal to ...
分类:
编程语言 时间:
2018-07-08 11:16:06
阅读次数:
161
Reverse a singly linked list. Example: Follow up: A linked list can be reversed either iteratively or recursively. Could you implement both? ...
分类:
编程语言 时间:
2018-07-08 11:15:50
阅读次数:
154
Given a linked list, swap every two adjacent nodes and return its head. Example: Note: Your algorithm should use only constant extra space. You may no ...
分类:
编程语言 时间:
2018-07-08 11:15:01
阅读次数:
215
Prior to Java 8, HashMap and all other hash table based Map implementation classes in Java handle collision by chaining, i.e. they use linked list to ...
分类:
编程语言 时间:
2018-07-07 10:34:54
阅读次数:
226
Given a sorted linked list, delete all duplicates such that each element appear only once. Example 1: Example 2: 很简单的链表问题,可以写成递归和迭代两种形式。具体思路: 第一步,寻找第一 ...
分类:
编程语言 时间:
2018-07-02 14:16:32
阅读次数:
175