题目链接:https://leetcode-cn.com/problems/odd-even-linked-list/ 给定一个单链表,把所有的奇数节点和偶数节点分别排在一起。请注意,这里的奇数节点和偶数节点指的是节点编号的奇偶性,而不是节点的值的奇偶性。 请尝试使用原地算法完成。你的算法的空间复杂 ...
分类:
其他好文 时间:
2019-08-26 09:38:12
阅读次数:
88
Given a constant K and a singly linked list L, you are supposed to reverse the links of every K elements on L. For example, given L being 1→2→3→4→5→6, ...
分类:
其他好文 时间:
2019-08-23 10:42:10
阅读次数:
92
Given a constant K and a singly linked list L, you are supposed to reverse the links of every K elements on L. For example, given L being 1→2→3→4→5→6, ...
分类:
其他好文 时间:
2019-08-19 09:37:19
阅读次数:
70
https://pintia.cn/problem-sets/994805342720868352/problems/994805425780670464 ...
分类:
其他好文 时间:
2019-08-18 11:38:05
阅读次数:
82
题目链接:https://leetcode cn.com/problems/reverse linked list/ 题目描述: 反转一个单链表。 示例: 思路: 迭代 递归: ...
分类:
其他好文 时间:
2019-08-17 22:30:12
阅读次数:
119
题目链接:https://leetcode cn.com/problems/remove linked list elements/ 题目描述: 删除链表中等于给定值 val 的所有节点。 示例: 思路: 迭代 递归 ...
分类:
其他好文 时间:
2019-08-17 22:00:51
阅读次数:
114
题目链接:https://leetcode-cn.com/problems/linked-list-cycle/ 给定一个链表,判断链表中是否有环。 为了表示给定链表中的环,我们使用整数 pos 来表示链表尾连接到链表中的位置(索引从 0 开始)。 如果 pos 是 -1,则在该链表中没有环。 示例 ...
分类:
其他好文 时间:
2019-08-16 23:20:17
阅读次数:
197
题目链接:https://leetcode-cn.com/problems/remove-linked-list-elements/ 删除链表中等于给定值 val 的所有节点。 示例: ...
分类:
其他好文 时间:
2019-08-16 22:50:31
阅读次数:
102
题目链接:https://leetcode-cn.com/problems/reverse-linked-list/ 反转一个单链表。 示例: 输入: 1->2->3->4->5->NULL输出: 5->4->3->2->1->NULL进阶:你可以迭代或递归地反转链表。你能否用两种方法解决这道题? ...
分类:
其他好文 时间:
2019-08-14 12:16:04
阅读次数:
92
problem:https://leetcode.com/problems/next-greater-node-in-linked-list/ 维护递减的单调栈。这道题对象是链表,不像数组可以快速通过下标索引,所以比较方便的做法是在栈中同时记录数字和对应的下标,并且默认填0,如果找到了比它大的第一个 ...
分类:
其他好文 时间:
2019-08-11 17:22:44
阅读次数:
134