摘要: Suppose a sorted array is rotated at some pivot unknown to you beforehand.(i.e.,0 1 2 4 5 6 7might become4 5 6 7 0 1 2).You are given a target value t... 阅读全文
posted @ 2015-04-08 19:48 niuer++ 阅读(109) 评论(0) 推荐(0)
摘要: Given a sorted array and a target value, return the index if the target is found. If not, return the index where it would be if it were inserted in or... 阅读全文
posted @ 2015-04-08 16:28 niuer++ 阅读(156) 评论(0) 推荐(0)
摘要: Given a sorted array and a target value, return the index if the target is found. If not, return the index where it would be if it were inserted in or... 阅读全文
posted @ 2015-04-08 16:19 niuer++ 阅读(149) 评论(0) 推荐(0)
摘要: 二分查找经常在有序数列中查找某个特定的位置。因此使用二分查找应满足以下两个条件:1:存储在数组中2:有序排列。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。Given a sorted array of integers, find the starting and endi... 阅读全文
posted @ 2015-04-08 15:09 niuer++ 阅读(231) 评论(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 @ 2015-04-08 10:05 niuer++ 阅读(141) 评论(0) 推荐(0)