Sort a linked list in O(n log n) time using constant space complexity.merge sort、heap sort和quick sort都是O(nlgn),但是mergesort和quicksort都是递归的,不是constant s...
分类:
其他好文 时间:
2014-07-06 21:07:41
阅读次数:
210
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 space?判断一...
分类:
其他好文 时间:
2014-07-06 18:10:33
阅读次数:
145
按照前序遍历的顺序把树用right连起来。本来想了半天,一点思路都没有,总觉得Inplace的解法一般都非常巧妙。后来我突发灵感,决定用一个变量记录当前访问到哪个点,真是太机智了~~ 1 /** 2 * Definition for binary tree 3 * struct TreeNode.....
分类:
其他好文 时间:
2014-07-06 14:02:26
阅读次数:
168
Given a linked list, reverse the nodes of a linked listkat a time and return its modified list.If the number of nodes is not a multiple ofkthen left-o...
分类:
其他好文 时间:
2014-07-03 23:51:47
阅读次数:
408
问题描述如下:Given a linked list, return the node where the cycle begins. If there is no cycle, return null.Follow up:Can you solve it without using extra s...
分类:
其他好文 时间:
2014-07-03 21:00:48
阅读次数:
401
Given a binary tree, flatten it to a linked list in-place.For example,Given 1 / \ 2 5 / \ \ 3 4 6The flattened t...
分类:
其他好文 时间:
2014-07-03 20:32:55
阅读次数:
429
Given a singly linked list where elements are sorted in ascending order, convert it to a height balanced BST.
分类:
其他好文 时间:
2014-07-03 19:10:40
阅读次数:
201
Given a sorted linked list, delete all duplicates such that each element appear onlyonce.For example,Given1->1->2, return1->2.Given1->1->2->3->3, retu...
分类:
其他好文 时间:
2014-07-03 18:57:04
阅读次数:
193
[LeetCode]Linked List Cycle...
分类:
其他好文 时间:
2014-07-03 18:42:10
阅读次数:
189
Given a binary tree, flatten it to a linked list in-place.
分类:
其他好文 时间:
2014-07-03 13:10:52
阅读次数:
204