摘要: 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 @ 2015-09-04 22:03 vincently 阅读(157) 评论(0) 推荐(0) 编辑
摘要: 题目来源:《剑指offer》面试题40 题目:一个整形数组除了两个数字之外,其他的数字都出现了两次。请写程序找出这两个只出现一次的数字。要求时间复杂度O(n),空间复杂度O(1) 分析:运用异或的思想。我们从头到尾一次异或数组中的每一个数字,那么最终得到的结果就是两个只出现一次的数字的异或结... 阅读全文
posted @ 2015-09-04 21:04 vincently 阅读(427) 评论(0) 推荐(0) 编辑
摘要: Suppose a sorted array is rotated at some pivot unknown to you beforehand.(i.e., 0 1 2 4 5 6 7 might become 4 5 6 7 0 1 2).Find the minimum element.Yo... 阅读全文
posted @ 2015-09-04 15:24 vincently 阅读(225) 评论(0) 推荐(0) 编辑