给一个链表,返回链表开始入环的第一个节点。 如果链表无环,则返回 null。说明:不应修改给定的链表。补充:你是否可以不用额外空间解决此题?详见:https://leetcode.com/problems/linked-list-cycle-ii/description/ ...
分类:
其他好文 时间:
2018-04-06 00:16:09
阅读次数:
373
给定一个链表,判断链表中否有环。补充:你是否可以不用额外空间解决此题?详见:https://leetcode.com/problems/linked-list-cycle/description/ ...
分类:
其他好文 时间:
2018-04-06 00:13:45
阅读次数:
263
我们继续来看链表的第二道题,来自于leetcode: 两数相加 给定两个非空链表来代表两个非负整数,位数按照逆序方式存储,它们的每个节点只存储单个数字。将这两数相加会返回一个新的链表。 你可以假设除了数字 0 之外,这两个数字都不会以零开头。 示例: 分析: 因为是位数按照逆序方式存储,所以链表的前 ...
分类:
编程语言 时间:
2018-04-05 11:55:27
阅读次数:
381
给定一个二叉树,使用原地算法将它 “压扁” 成链表。示例:给出: 1 / \ 2 5 / \ \ 3 4 6压扁后变成如下: 1 \ 2 \ 3 \ 4 \ 5 \ 6提示:如果您细心观察该扁平树,则会发现每个节点的右侧子节点是以原二叉树前序遍历的次序指向下一个节点的。 详见:https://lee ...
分类:
其他好文 时间:
2018-04-05 01:12:59
阅读次数:
266
原题链接: "https://leetcode.com/problems/reverse linked list/description/" 题目本身不难,难的是怎么写出高效优雅的代码来: ...
分类:
其他好文 时间:
2018-04-03 14:20:48
阅读次数:
118
Insert a new element at a specific index in the given linked list. The index is 0 based, and if the index is out of the list's scope, you do not need ...
分类:
其他好文 时间:
2018-03-29 13:28:45
阅读次数:
190
1、问题描述 Remove all elements from a linked list of integers that have value val. ExampleGiven: 1 --> 2 --> 6 --> 3 --> 4 --> 5 --> 6, val = 6Return: 1 - ...
分类:
其他好文 时间:
2018-03-29 13:27:57
阅读次数:
161
Delete the node at the given index for the given linked list. Examples [1, 2, 3], delete at 1 --> [1, 3] [1, 2, 3], delete at 4 --> [1, 2, 3] [1, 2, 3 ...
分类:
其他好文 时间:
2018-03-27 14:35:38
阅读次数:
97
Return the number of nodes in the linked list. Examples L = null, return 0L = 1 -> null, return 1L = 1 -> 2 -> null, return 2 ...
分类:
其他好文 时间:
2018-03-27 14:33:10
阅读次数:
108
中国大学MOOC-陈越、何钦铭-数据结构-2018春 课后习题第二讲第三题 ...
分类:
其他好文 时间:
2018-03-26 10:51:22
阅读次数:
199