很简单的面试问题

来源: 2012-12-06 12:09:49 [博客] [旧帖] [给我悄悄话] 本文已被阅读:

这几天我们在面试candidate for a sr. .net developer. 我们问了这样一个问题:

Given a sorted array of integers like:

[1, 3, 4, 7, 11, 14, 15, 19, 21].

 

Please complete the following function that searches for an integer in the array and returns the position if the number is found or -1 if not found:

 

int FindNumber(int[] array, int n)

{

    ......

}

 

No candidate has finished the function to our expection.  

看上去很简单的问题吗?