Given an unsorted integer array, find the first missing positive integer.For example,Given[1,2,0]return3,and[3,4,-1,1]return2.Your algorithm should ru...
分类:
其他好文 时间:
2014-07-22 22:52:33
阅读次数:
166
Merge Two Sorted ListsMerge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of the fir...
分类:
其他好文 时间:
2014-07-22 22:51:35
阅读次数:
146
Jzzhu has a big rectangular chocolate bar that consists of n?×?m unit squares. He wants to cut this bar exactly k times.
Each cut must meet the following requirements:
each cut should be straig...
分类:
其他好文 时间:
2014-07-22 22:49:15
阅读次数:
192
The DecoderWrite a complete program that will correctly decode a set of characters into a valid message. Your program should read a given file of a si...
分类:
其他好文 时间:
2014-07-22 00:38:34
阅读次数:
235
Given an array of integers, every element appearsthreetimes except for one. Find that single one.Note:Your algorithm should have a linear runtime comp...
分类:
其他好文 时间:
2014-07-22 00:28:38
阅读次数:
209
Partition ListGiven a linked list and a valuex, partition it such that all nodes less thanxcome before nodes greater than or equal tox.You should pres...
分类:
其他好文 时间:
2014-07-21 08:28:54
阅读次数:
230
Given an array of integers, every element appearstwiceexcept for one. Find that single one.Note:Your algorithm should have a linear runtime complexity...
分类:
其他好文 时间:
2014-07-21 00:39:31
阅读次数:
249
Dictionaries have a method called items that returns a list of tuples, where each tuple is a key-value pair. As you should expect from a dictionary, t...
分类:
其他好文 时间:
2014-07-19 23:02:40
阅读次数:
372
Swap Nodes in PairsGiven a linked list, swap every two adjacent nodes and return its head.For example,Given1->2->3->4, you should return the list as2-...
分类:
其他好文 时间:
2014-07-19 22:25:10
阅读次数:
210
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:
1...
分类:
其他好文 时间:
2014-07-19 11:47:54
阅读次数:
168