Linked List CycleGiven a linked list, determine if it has a cycle in it.c++/** * Definition for singly-linked list. * struct ListNode { * int val;...
分类:
其他好文 时间:
2014-10-19 23:04:39
阅读次数:
206
Problem:Given a linked list, remove thenthnode from the end of list and return its head.For example, Given linked list: 1->2->3->4->5, and n = 2. ...
分类:
其他好文 时间:
2014-10-19 01:12:55
阅读次数:
190
Given a linked list, determine if it has a cycle in it.Follow up:Can you solve it without using extra space?Solution:快慢指针。 1 /** 2 * Definition for s....
分类:
其他好文 时间:
2014-10-17 15:16:48
阅读次数:
179
[leetcode]Given a binary tree, flatten it to a linked list in-place....
分类:
其他好文 时间:
2014-10-17 12:03:13
阅读次数:
119
Given a singly linked list where elements are sorted in ascending order, convert it to a height balanced BST.这题和sort list等题都比较相似,需要先用快慢指针的方法找到链表的中点,然后...
分类:
其他好文 时间:
2014-10-16 22:31:43
阅读次数:
217
问题: 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 ...
分类:
其他好文 时间:
2014-10-15 15:40:50
阅读次数:
262
题目描述:Given a linked list, return the node where the cycle begins. If there is no cycle, returnnull.Follow up:Can you solve it without using extra spac...
分类:
其他好文 时间:
2014-10-15 11:10:10
阅读次数:
219
题目描述:Given a linked list, determine if it has a cycle in it.Follow up:Can you solve it without using extra space?解题方案:使用快慢指针,如果有环,快指针肯定会追上慢指针。下面是该题的代码...
分类:
其他好文 时间:
2014-10-15 00:03:19
阅读次数:
183
Given a linked list, remove thenthnode from the end of list and return its head.For example, Given linked list: 1->2->3->4->5, and n = 2. After re...
分类:
其他好文 时间:
2014-10-14 14:52:58
阅读次数:
168