Given a binary tree, flatten it to a linked list in-place.For example,Given 1 / \ 2 5 / \ \ 3 4 6The flattened t...
分类:
其他好文 时间:
2014-09-16 04:57:10
阅读次数:
134
原题地址:http://oj.leetcode.com/problems/swap-nodes-in-pairs/Given a linked list, swap every two adjacent nodes and return its head.For example,Given 1->2...
分类:
编程语言 时间:
2014-09-15 06:38:18
阅读次数:
200
原题地址:https://oj.leetcode.com/problems/reverse-linked-list-ii/题意:Reverse a linked list from positionmton. Do it in-place and in one-pass.For example:Gi...
分类:
编程语言 时间:
2014-09-14 23:38:47
阅读次数:
239
Given a binary tree, flatten it to a linked list in-place.For example,Given 1 / \ 2 5 / \ \ 3 4 6The flattened t...
分类:
其他好文 时间:
2014-09-13 22:39:06
阅读次数:
238
Sort a linked list in O(n log n) time using constant space complexity./** * Definition for singly-linked list. * struct ListNode { * int val; * ...
分类:
其他好文 时间:
2014-09-13 21:25:35
阅读次数:
288
Sort a linked list inO(nlogn) time using constant space complexity. 1 /** 2 * Definition for singly-linked list. 3 * struct ListNode { 4 * int ...
分类:
其他好文 时间:
2014-09-13 20:08:05
阅读次数:
204
Given a linked list, determine if it has a cycle in it.Follow up:Can you solve it without using extra space? 1 /** 2 * Definition for singly-linked l....
分类:
其他好文 时间:
2014-09-13 20:06:35
阅读次数:
184
Sort a linked list using insertion sort. 1 /** 2 * Definition for singly-linked list. 3 * struct ListNode { 4 * int val; 5 * ListNode *nex...
分类:
其他好文 时间:
2014-09-13 20:05:15
阅读次数:
180
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? 1 ...
分类:
其他好文 时间:
2014-09-13 20:03:55
阅读次数:
205
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-09-13 20:01:15
阅读次数:
205