题目链接:https://leetcode.com/problems/rotate-list/description/ Given a sorted linked list, delete all duplicates such that each element appear only once. ...
分类:
其他好文 时间:
2018-11-04 01:52:25
阅读次数:
157
这里介绍几种数据结构在Java中的实现,其实之前写了几篇文章介绍数据结构,只写了栈和队列。现在准备介绍一下 1.数组Array 2.栈Stack 3.队列Queue 4.链表Linked List 5.哈希表Hash 6.堆Heap 7.图Graph 8.树Tree ...
分类:
编程语言 时间:
2018-11-01 12:03:27
阅读次数:
149
Given a linked list, return the node where the cycle begins. If there is no cycle, return null.Note: Do not modify the linked list.想法:(1)首先的判断链表中是否有环,... ...
分类:
其他好文 时间:
2018-10-31 13:49:01
阅读次数:
173
Remove all elements from a linked list of integers that have value val. Example: 很浅显易懂的问题,遇到不同的就删,同样的就下一个。 ...
分类:
其他好文 时间:
2018-10-31 01:12:18
阅读次数:
174
分析 难度 易 来源 https://leetcode.com/problems/remove-duplicates-from-sorted-list/ 题目 Given a sorted linked list, delete all duplicates such that each eleme ...
分类:
其他好文 时间:
2018-10-29 22:57:52
阅读次数:
236
Given a singly linked list, determine if it is a palindrome. Example 1: Example 2: Follow up:Could you do it in O(n) time and O(1) space?判断单链表是不是回文串,首 ...
分类:
其他好文 时间:
2018-10-29 00:33:49
阅读次数:
159
Reverse a linked list from position m to n. Do it in one-pass. Note: 1 ≤ m ≤ n ≤ length of list. Example: AC code: Runtime: 0 ms, faster than 100.00% ...
分类:
其他好文 时间:
2018-10-28 22:07:14
阅读次数:
177
Reverse a singly linked list.Example:Input: 1->2->3->4->5->NULLOutput: 5->4->3->2->1->NULL想法:设置两个指针,一个指向当前节点,另一个指向当前节点的写一个节点。然后逐个反转/** * Definition fo... ...
分类:
其他好文 时间:
2018-10-28 21:55:16
阅读次数:
183
Write a function to delete a node (except the tail) in a singly linked list, given only access to that node.Given linked list -- head = [4,5,1,9], whi... ...
分类:
其他好文 时间:
2018-10-27 21:44:21
阅读次数:
154
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 middle... ...
分类:
其他好文 时间:
2018-10-27 14:52:07
阅读次数:
101