油工 is Weird!# Stock
w*o
1 楼
没有太弄明白。
电话面被问到:
说是给了一个排好序的数组,找出K个和target最接近的数字。
没有太弄明白题,可是面试的人说这是个常见题,在leetcode上找了也没有看到。
大概俺的理解是比如
A={ 1, 3, 4, 7, 9, 12, 13, 14, 17, 20}
给个数字比如10作为target,给K=3,找和数字10最接近的三个数字,就是7,9,12.
返回一个数组的index的range,
就是{3,5}, 是这样子的吗?谢谢!
电话面被问到:
说是给了一个排好序的数组,找出K个和target最接近的数字。
没有太弄明白题,可是面试的人说这是个常见题,在leetcode上找了也没有看到。
大概俺的理解是比如
A={ 1, 3, 4, 7, 9, 12, 13, 14, 17, 20}
给个数字比如10作为target,给K=3,找和数字10最接近的三个数字,就是7,9,12.
返回一个数组的index的range,
就是{3,5}, 是这样子的吗?谢谢!