原文地址:https://www.jianshu.com/p/e8481d454076 时间限制:1秒 空间限制:32768K 题目描述 A linked list is given such that each node contains an additional random pointer ...
分类:
其他好文 时间:
2019-05-10 14:36:35
阅读次数:
124
原文地址:https://www.jianshu.com/p/21009b10c42d 时间限制:1秒 空间限制:32768K 题目描述 Given a linked list, return the node where the cycle begins. If there is no cycle ...
分类:
其他好文 时间:
2019-05-10 14:33:18
阅读次数:
76
题目描述 将两个有序链表合并为一个新的有序链表并返回。新链表是通过拼接给定的两个链表的所有节点组成的。 示例: 分析 类似于归并排序中的合并过程,如果任何一个(l1,l2)为空,直接链接另一条。 贴出代码 java / Definition for singly linked list. publi ...
分类:
其他好文 时间:
2019-05-10 11:26:49
阅读次数:
124
题目: Sort a linked list in O(n log n) time using constant space complexity. 参考链接: 思路: ...
分类:
编程语言 时间:
2019-05-07 21:11:46
阅读次数:
137
这个题目有两种做法, note: 注意head.random有可能是None的情况 1. S: O(n) create一个dictionary,然后先建dictionary和copy list以及next指针。然后再一遍,去建random指针。 2: S: O(1) 利用如下图所示的结构,然后再将c ...
分类:
其他好文 时间:
2019-05-04 11:55:30
阅读次数:
110
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 preserve the ...
分类:
其他好文 时间:
2019-05-02 11:38:39
阅读次数:
102
Given a non-empty, singly linked list with head node head, return a middle node of linked list. If there are two middle nodes, return the second middl ...
分类:
其他好文 时间:
2019-05-02 11:23:58
阅读次数:
107
A linked list is given such that each node contains an additional random pointer which could point to any node in the list or null. Return a deep copy ...
分类:
其他好文 时间:
2019-05-02 09:37:35
阅读次数:
93
Given a sorted linked list, delete all duplicates such that each element appear only once. Example 1: Example 2: ...
分类:
其他好文 时间:
2019-05-01 13:45:03
阅读次数:
153
Given a sorted linked list, delete all nodes that have duplicate numbers, leaving only distinctnumbers from the original list. Example 1: Example 2: ...
分类:
其他好文 时间:
2019-05-01 13:21:13
阅读次数:
123