LeetCode 142. Linked List Cycle II LeetCode 148. Sort List LeetCode 146. LRU Cache LeetCode 473. Matchsticks to Square LeetCode 301. Remove Invalid Pa ...
分类:
其他好文 时间:
2018-07-28 15:08:56
阅读次数:
128
```C++ /** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode(int x) : val(x), next(NULL) {} * }; */ cla... ...
分类:
移动开发 时间:
2018-07-28 13:35:42
阅读次数:
141
一、常见的链表 1、单链表(Singly Linked List) 构成:每个节点包含数据(data)和后继节点的地址(next) 2、双向链表 构成:每个节点包含数据(data)、前驱的地址(prev)、后继的地址(next) 优势:删除或添加元素不需要移动数据,可以双向遍历 3、异或链表(XOR ...
分类:
其他好文 时间:
2018-07-27 01:12:57
阅读次数:
177
1、Reverse Linked ListⅠ Reverse a singly linked list. Example: Input: 1->2->3->4->5->NULL Output: 5->4->3->2->1->NULL Follow up: A linked list can be r ...
分类:
其他好文 时间:
2018-07-26 23:28:52
阅读次数:
156
题目链接: "LeetCode 430. Faltten a Multilevel Doubly Linked List" ...
分类:
其他好文 时间:
2018-07-26 14:53:07
阅读次数:
278
Remove all elements from a linked list of integers that have value val. Example: Input: 1->2->6->3->4->5->6, val = 6 Output: 1->2->3->4->5 Remove all ...
分类:
其他好文 时间:
2018-07-25 21:11:55
阅读次数:
130
```C++ /** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode(int x) : val(x), next(NULL) {} * }; */ cla... ...
分类:
编程语言 时间:
2018-07-24 19:17:18
阅读次数:
174
tree,是非线性数据结构,array、linked list、stack、queue,是线性数据结构。 线性数据结构:数据元素是一对一 非线性数据结构:数据元素存在一对多或者多对一的关系 ...
分类:
其他好文 时间:
2018-07-24 11:54:38
阅读次数:
129
今天总结一下用Floyd算法来判断链表中是否有环,如果有环,如何找到环的入口。这一系列问题。 1、Linked List Cycle Ⅰ Given a linked list, determine if it has a cycle in it. Follow up:Can you solve i ...
分类:
其他好文 时间:
2018-07-23 18:04:55
阅读次数:
166
题目描述: 从一个整型链表里面移除值等于val的节点。 解题思路: 需要一个指针指向前驱节点,遍历链表,针对符合条件的节点,分两种情况处理 1)如果前驱节点不为空,前驱节点指向当前节点的下一个节点 2)如果前驱节点为空,头指针指向当前节点下一个节点 如果节点的值不等于val,前驱节点指针指向当前节点 ...
分类:
其他好文 时间:
2018-07-22 20:07:15
阅读次数:
130