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 original relative order of the nodes in each of...
分类:
其他好文 时间:
2014-12-25 22:10:27
阅读次数:
180
Merge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes
of the first two lists.
题目意思为合并两个链表,不能用额外的空间(新链由两个链拼接而成)
思路:
比较简单,直接定义两个指针,分别...
分类:
其他好文 时间:
2014-12-25 22:09:16
阅读次数:
186
Given a linked list, reverse the nodes of a linked list k at a time and return its modified list.
If the number of nodes is not a multiple of k then left-out nodes in the end should remain as it is...
分类:
其他好文 时间:
2014-12-25 11:25:56
阅读次数:
146
Given an array of integers and a number k, find k non-overlapping subarrays which have the largest sum.The number in each subarray should be contiguou...
分类:
其他好文 时间:
2014-12-25 09:55:31
阅读次数:
235
Given an array of integers, find two non-overlapping subarrays which have the largest sum.The number in each subarray should be contiguous.Return the ...
分类:
其他好文 时间:
2014-12-25 08:44:08
阅读次数:
232
题目:
Merge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of the first two lists.
解决方案:
/**
* Definition for singly-linked list.
...
分类:
其他好文 时间:
2014-12-24 21:32:44
阅读次数:
236
描述:Given an array of integers, find two numbers such that they add up to a specific target number.The function twoSum should return indices of the two...
分类:
其他好文 时间:
2014-12-24 20:03:47
阅读次数:
129
【题目】
Given a binary tree, flatten it to a linked list in-place.
For example,
Given
1
/ 2 5
/ \ 3 4 6
The flattened tree should look like:...
分类:
其他好文 时间:
2014-12-24 18:14:47
阅读次数:
119
参考:http://stackoverflow.com/questions/1711/what-is-the-single-most-influential-book-every-programmer-should-readCode Complete (2nd edition) by Steve M...
分类:
其他好文 时间:
2014-12-24 13:17:55
阅读次数:
239
BT(binary tree), want to find the LIS(largest independent set) of the BT. LIS: if the current node is in the set, then its children should not be in t...
分类:
其他好文 时间:
2014-12-24 08:40:08
阅读次数:
120