CareerCup Google Interview 找到两个数的差为一个特定数 - chkkch - 博客园
Given an integer 'k' and an sorted array A (can consist of both +ve/-ve nos), output 2 integers from A such that a-b=k.
PS:
nlogn solution would be to check for the occurence of k-a[i] (using binary search) when you encounter a[i]. methods like hash consume space.
Is an O(n) solution with O(1) extraspace possible?
http://www.careercup.com/question?id=9449188
Read full article from CareerCup Google Interview 找到两个数的差为一个特定数 - chkkch - 博客园