摘要: Reverse a linked list from positionmton. Do it in-place and in one-pass.For example:Given1->2->3->4->5->NULL,m= 2 andn= 4,return1->4->3->2->5->NULL.No... 阅读全文
posted @ 2014-06-20 09:58 穆穆兔兔 阅读(201) 评论(0) 推荐(0)
摘要: Given a sorted array of integers, find the starting and ending position of a given target value.Your algorithm's runtime complexity must be in the ord... 阅读全文
posted @ 2014-06-19 16:43 穆穆兔兔 阅读(248) 评论(0) 推荐(0)
摘要: STL中的每个算法都非常精妙, ForwardIterlower_bound(ForwardIter first, ForwardIter last,const _Tp& val)算法返回一个非递减序列[first, last)中的第一个大于等于值val的位置。 ForwardIter uppe... 阅读全文
posted @ 2014-06-18 17:44 穆穆兔兔 阅读(634) 评论(0) 推荐(0)
摘要: Given an arraySofnintegers, are there elementsa,b,c, anddinSsuch thata+b+c+d= target? Find all unique quadruplets in the array which gives the sum of ... 阅读全文
posted @ 2014-06-18 15:50 穆穆兔兔 阅读(208) 评论(0) 推荐(0)
摘要: Given an arraySofnintegers, find three integers inSsuch that the sum is closest to a given number, target. Return the sum of the three integers. You m... 阅读全文
posted @ 2014-06-18 13:45 穆穆兔兔 阅读(163) 评论(0) 推荐(0)
摘要: Given an array S of n integers, are there elements a, b, c in S such that a + b + c = 0? Find all uniquetriplets in the array which gives the sum of z... 阅读全文
posted @ 2014-06-18 10:27 穆穆兔兔 阅读(219) 评论(0) 推荐(0)
摘要: 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 nu... 阅读全文
posted @ 2014-06-17 17:14 穆穆兔兔 阅读(266) 评论(0) 推荐(0)
摘要: 1.map, multimap, set, multisetg++ 中 map, multimap, set, multiset 由红黑树实现map: bits/stl_map.hmultimap: bits/stl_multimap.hset: bits/stl_set.hmultiset: bi... 阅读全文
posted @ 2014-06-17 15:02 穆穆兔兔 阅读(442) 评论(0) 推荐(0)
摘要: There areNgas stations along a circular route, where the amount of gas at stationiisgas[i].You have a car with an unlimited gas tank and it costscost[... 阅读全文
posted @ 2014-06-16 16:32 穆穆兔兔 阅读(282) 评论(0) 推荐(0)
摘要: Given an unsorted array of integers, find the length of the longest consecutive elements sequence.For example,Given[100, 4, 200, 1, 3, 2],The longest ... 阅读全文
posted @ 2014-06-16 15:51 穆穆兔兔 阅读(170) 评论(0) 推荐(0)