這幾天我們在麵試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.
看上去很簡單的問題嗎?