f家电面面经# JobHunting - 待字闺中
b*i
1 楼
刚面的。。。
第二题跪了。。
1. 3sum
Given an array of integers
[1, 2, -3, 4, 0]
To find any 3 numbers in array such that they sum to zero.
eg:
1) 1 , 2, -3
2) 0, 0, 0
2. Q2: Given set of points in 2d grid space. Find a grid point such that sum
of distance from all the points to this common point is minimum.
eg: p1: [0, 0] p2: [3, 0] p3: [0, 3]
ans: r: [0,0]
sum: 0 + 3 + 3 = 6
for every other point sum to this ans greater than 6.
实在不知道是啥,乱说了个找mininum manhattan distance,然后赶紧临时google下,
貌似是找median,然后对方说能不能证明一下。。表示不会。。。
这题正解到底是啥?
第二题跪了。。
1. 3sum
Given an array of integers
[1, 2, -3, 4, 0]
To find any 3 numbers in array such that they sum to zero.
eg:
1) 1 , 2, -3
2) 0, 0, 0
2. Q2: Given set of points in 2d grid space. Find a grid point such that sum
of distance from all the points to this common point is minimum.
eg: p1: [0, 0] p2: [3, 0] p3: [0, 3]
ans: r: [0,0]
sum: 0 + 3 + 3 = 6
for every other point sum to this ans greater than 6.
实在不知道是啥,乱说了个找mininum manhattan distance,然后赶紧临时google下,
貌似是找median,然后对方说能不能证明一下。。表示不会。。。
这题正解到底是啥?