Redian新闻
>
walmartLab面经 phone interview
avatar
walmartLab面经 phone interview# JobHunting - 待字闺中
s*r
1
两轮 phone interview
第一轮
亚裔面试官,很nice,很详细问了当前project,问到许多细节的处理
算法题 reverse words in a string.
"It is good"--------->"good is It"
很简单,写完的时候有个bug,让我检查 发现了改了
然后又提示把reverse string的函数单独提出来
follow question问能不能处理 string 前后中许多空白
我说可以 他觉得不可以 我们一块走了一遍code 可以
结束了
第二轮
面试官烙印,交流有问题,至少两处都要求重复了两三遍才听懂
先一个一个的让介绍自己的project 大概20分钟 基本都是我在说
然后开始算法题
Q1
find longest palindrome in a string leetcode原题
解释思路,对每个character 从中间向两边扫 找最长的 他说ok
开始写 写到一半 考虑到偶数的情况,说还要考虑从中间两个character往两边扫
code,然后继续写 还没写完就被烙印打断 说u r on the right track 就下一题了
Q2 Let say you are given all pairwise distances between n points, points in
3d, compute a coordinate representation of the points such that the euclid
distance matches the input distance
x = sqrt(2)
eg) 1 2 3 4
1 0 1 1 1
2 1 0 x x
3 1 x 0 x
4 1 x x 0
output
1: (0,0,0)
2: (1,0,0)
3: (0,1,0)
4: (0,0,-1)
心想这code也太难了吧 有点懵 不知道他是什么意思 想了一会儿还是没思路
试着问 只给距离不给坐标系 解并不唯一 可以选择坐标系有很多解啊? 他说是的 就
沉默了
还是没思路 只好任意发挥,说可以先选两点确定一线作为x轴,然后再选一个不在一条
线上的第三点确定以平面然后确定y轴 后面还没说怎么确定z轴 就又被打断了 ok let'
s move on next
Q3 given 2 distance matrices M1, M2 that represent distances bw points in 2d
, check if the point sets are equivalent (same upto translation + rotation)
这时候还没从上一题中回复过来脑子已经不转了,就brute force吧
说两matrix里的每行对比,看M1中的一行是不是可以通过M2中某一行交换顺序得到 如
果不能返回false,如果可以,对M1所有列做相同的顺序变换 看能不能对M1中的每一行
都在M2中找到对应的
还没说完 又被打断了 让问个问题就结束了
和烙印交流不太顺利 肯定是挂了
move on了 题目还是分享一下吧 万一后面有面的兄弟可以有点心理准备
avatar
z*2
2
感謝分享, Q2 很難
leetcode 沒有 reverse words in a string
avatar
s*r
3
那是我记错了 oj里确实没有
可能是在leetcode的blog entry里或者别处看到的
嗯 Q2我只能当数学题目来想想
下次再有这样问的烙印我就直接投降主动让他move on next...

【在 z***2 的大作中提到】
: 感謝分享, Q2 很難
: leetcode 沒有 reverse words in a string

avatar
l*b
4
Q3:
1. each point has a key: sorted distances to other points
2. sort all points according to this key
3. the matrix is re-arranged accordingly by row + col permutation
4. verify if the matrices are equal to each other
Not very efficient though... actually slow and hard to write
avatar
f*e
5
Q2只想到了N^4的解法,Q3 isomophism,先coarse filter,再finer filter。

【在 s*******r 的大作中提到】
: 两轮 phone interview
: 第一轮
: 亚裔面试官,很nice,很详细问了当前project,问到许多细节的处理
: 算法题 reverse words in a string.
: "It is good"--------->"good is It"
: 很简单,写完的时候有个bug,让我检查 发现了改了
: 然后又提示把reverse string的函数单独提出来
: follow question问能不能处理 string 前后中许多空白
: 我说可以 他觉得不可以 我们一块走了一遍code 可以
: 结束了

avatar
l*b
6
Q2: three points that satisfy a triangle inequality will form a triangle,
pick a 4-th point not on the same plane, it will decide the orintation of
the space. They can be fit into the space in arbitrary orientation.
Coordinates of all other points can be determined by their distance to these
four points.
But it's still hard to figure out their exact coordinates. You will need to
dervive some formulas using some area, volumn, distance to get their
coordinates more efficiently. I guess.
Edit: with coordinate of 4 points given and distance to them, coordinate of
another point is given by (x,y,z), you can reduce it to a 3 variable 3
equation linear system. So it will be solve in linear time. :)

【在 s*******r 的大作中提到】
: 那是我记错了 oj里确实没有
: 可能是在leetcode的blog entry里或者别处看到的
: 嗯 Q2我只能当数学题目来想想
: 下次再有这样问的烙印我就直接投降主动让他move on next...

avatar
s*r
7
果然大牛 说的名词我都不认识
说说N^4的解法?

【在 f*****e 的大作中提到】
: Q2只想到了N^4的解法,Q3 isomophism,先coarse filter,再finer filter。
avatar
f*e
8
每加入一个点i+1,用1至i中的3个点可以确定i+1只有两个位置,这个耗费常数时间c,
然后确定它与已经加入的所有点1至i的距离是否满足矩阵。所以是
sum(1+2+...+N)=O(N^2)

【在 s*******r 的大作中提到】
: 果然大牛 说的名词我都不认识
: 说说N^4的解法?

avatar
f*e
9
Q3用凸包比较好做,记录polar angle和distance。也只要O(N^2)

【在 f*****e 的大作中提到】
: 每加入一个点i+1,用1至i中的3个点可以确定i+1只有两个位置,这个耗费常数时间c,
: 然后确定它与已经加入的所有点1至i的距离是否满足矩阵。所以是
: sum(1+2+...+N)=O(N^2)

avatar
p*2
10
LZ是ACMer吗?怎么电面这么难呢?
avatar
A*o
11
luckynoob gave an answer to Q2, not repeating ,,,
avatar
s*r
12
不是
面试的时候一直让我说 自己很少说话
会做的不让做完 换个偏题给我做也不给提示 看我做不出接着再来一道类似的
我不负责任的胡乱推测一下安慰自己: 是被烙印给黑了

【在 p*****2 的大作中提到】
: LZ是ACMer吗?怎么电面这么难呢?
avatar
s*r
13
差距啊 极坐标我现在也只记得一个名词了 回去复习去!

【在 f*****e 的大作中提到】
: Q3用凸包比较好做,记录polar angle和distance。也只要O(N^2)
avatar
s*r
14
嗯 我的思路也是这样 不过没有你想的这么细
可能口语不行吧 烙印都没耐心听我把坐标系建立完

these
to
of

【在 l*******b 的大作中提到】
: Q2: three points that satisfy a triangle inequality will form a triangle,
: pick a 4-th point not on the same plane, it will decide the orintation of
: the space. They can be fit into the space in arbitrary orientation.
: Coordinates of all other points can be determined by their distance to these
: four points.
: But it's still hard to figure out their exact coordinates. You will need to
: dervive some formulas using some area, volumn, distance to get their
: coordinates more efficiently. I guess.
: Edit: with coordinate of 4 points given and distance to them, coordinate of
: another point is given by (x,y,z), you can reduce it to a 3 variable 3

avatar
l*b
15
电面时间不多呀, 这个坐下来自己想肯定能搞清楚的, 面起来就不好说了, 感觉.

【在 s*******r 的大作中提到】
: 嗯 我的思路也是这样 不过没有你想的这么细
: 可能口语不行吧 烙印都没耐心听我把坐标系建立完
:
: these
: to
: of

avatar
x*0
16
mark
avatar
r*n
17
Q2 idea
显然坐标系不是唯一的,
让第一个点是原点(0,0,0)
让第二个点在x axis上面,这样第二个点的坐标是(d12,0,0),同时确立了x axis的方向
让第三个点在x-y平面上面,这样第三个点的坐标可以表示为(x3,y3,0),通过d13,d23
解一个2元2次方程,并让y3取正值,这样相当于确立了y-axis方向(如果y3取负值,y-
axis就反向而已)(这里有个细节,如果1,2,3三个点在同一线上,那么是无法确立y
axis,这个时候就要找下面一个点了)
有了x axis和y axis,z axis就自动确立了。
剩下来的点的坐标假设为(a,b,c),通过列方程求解。
avatar
p*e
18
Q2估计老印也觉得不适合作为面试题,就move on了
avatar
r*n
19
Q3 idea
通过Q2,我们可以从M1,M2算出每个点在两个坐标系的坐标。通过M1算出来的坐标是ui
,i = 1, ..., n,同理通过M2算出来的坐标是vi。Q3实际上等同于问有没有线性变换
把一个坐标系换成另外一个坐标系,or equivalently does there exist a matrix A
such that
A*ui = vj for some i,j = 1,...,n
A represents rotation and the translation (means swap of indices?) is
captured by the the fact i,j could be different.
但是这个怎么解,还没想出来。
LZ面的职位不是纯码工吧
avatar
A*o
20
Q2的结果可以用来解Q3,O(n^2)
avatar
s*l
21
Q3:
求和,平方求和,三次方求和,...
或者 每项d_(ij)换成exp(-d_(ij)*d_(ij)/sigma), 任取sigma, 再求和,
如果对两个矩阵用以上的运算得到的和都一样的话,可以肯定两个点集是isometry(旋
转平移)
Keywords: euclidean distance matrix, isometry-invariant
avatar
s*l
22

或者检查两组特征值是否一致,不过复杂度(N^3)应该比上面的求和复杂度(N^2)高。

【在 s*********l 的大作中提到】
: Q3:
: 求和,平方求和,三次方求和,...
: 或者 每项d_(ij)换成exp(-d_(ij)*d_(ij)/sigma), 任取sigma, 再求和,
: 如果对两个矩阵用以上的运算得到的和都一样的话,可以肯定两个点集是isometry(旋
: 转平移)
: Keywords: euclidean distance matrix, isometry-invariant

avatar
a*g
23
请问面的是什么职位,是SE吗?还是他家data scientist也是这么面?谢谢了
avatar
c*t
24
弱问一下Q3,就算所有distance都一样,也不一定是相同点集合啊
极端一点
矩阵M 0 1
矩阵N 0 1
M和N能代表相同两个点吗?

【在 s*******r 的大作中提到】
: 两轮 phone interview
: 第一轮
: 亚裔面试官,很nice,很详细问了当前project,问到许多细节的处理
: 算法题 reverse words in a string.
: "It is good"--------->"good is It"
: 很简单,写完的时候有个bug,让我检查 发现了改了
: 然后又提示把reverse string的函数单独提出来
: follow question问能不能处理 string 前后中许多空白
: 我说可以 他觉得不可以 我们一块走了一遍code 可以
: 结束了

avatar
s*r
25
两轮 phone interview
第一轮
亚裔面试官,很nice,很详细问了当前project,问到许多细节的处理
算法题 reverse words in a sentence.
"It is good"--------->"good is It"
很简单,写完的时候有个bug,让我检查 发现了改了
然后又提示把reverse string的函数单独提出来
follow question问能不能处理 string 前后中许多空白
我说可以 他觉得不可以 我们一块走了一遍code 可以
结束了
第二轮
面试官烙印,交流有问题,至少两处都要求重复了两三遍才听懂
先一个一个的让介绍自己的project 大概20分钟 基本都是我在说
然后开始算法题
Q1
find longest palindrome in a string leetcode原题
解释思路,对每个character 从中间向两边扫 找最长的 他说ok
开始写 写到一半 考虑到偶数的情况,说还要考虑从中间两个character往两边扫
code,然后继续写 还没写完就被烙印打断 说u r on the right track 就下一题了
Q2 Let say you are given all pairwise distances between n points, points in
3d, compute a coordinate representation of the points such that the euclid
distance matches the input distance
x = sqrt(2)
eg) 1 2 3 4
1 0 1 1 1
2 1 0 x x
3 1 x 0 x
4 1 x x 0
output
1: (0,0,0)
2: (1,0,0)
3: (0,1,0)
4: (0,0,-1)
心想这code也太难了吧 有点懵 不知道他是什么意思 想了一会儿还是没思路
试着问 只给距离不给坐标系 解并不唯一 可以选择坐标系有很多解啊? 他说是的 就
沉默了
还是没思路 只好任意发挥,说可以先选两点确定一线作为x轴,然后再选一个不在一条
线上的第三点确定以平面然后确定y轴 后面还没说怎么确定z轴 就又被打断了 ok let'
s move on next
Q3 given 2 distance matrices M1, M2 that represent distances bw points in 2d
, check if the point sets are equivalent (same upto translation + rotation)
这时候还没从上一题中回复过来脑子已经不转了,就brute force吧
说两matrix里的每行对比,看M1中的一行是不是可以通过M2中某一行交换顺序得到 如
果不能返回false,如果可以,对M1所有列做相同的顺序变换 看能不能对M1中的每一行
都在M2中找到对应的
还没说完 又被打断了 让问个问题就结束了
和烙印交流不太顺利 肯定是挂了
move on了 题目还是分享一下吧 万一后面有面的兄弟可以有点心理准备
avatar
z*2
26
感謝分享, Q2 很難
leetcode 沒有 reverse words in a string
avatar
s*r
27
那是我记错了 oj里确实没有
可能是在leetcode的blog entry里或者别处看到的
嗯 Q2我只能当数学题目来想想
下次再有这样问的烙印我就直接投降主动让他move on next...

【在 z***2 的大作中提到】
: 感謝分享, Q2 很難
: leetcode 沒有 reverse words in a string

avatar
l*b
28
Q3:
1. each point has a key: sorted distances to other points
2. sort all points according to this key
3. the matrix is re-arranged accordingly by row + col permutation
4. verify if the matrices are equal to each other
Not very efficient though... actually slow and hard to write
avatar
f*e
29
Q2只想到了N^2的解法,Q3 isomophism,先coarse filter,再finer filter。

【在 s*******r 的大作中提到】
: 两轮 phone interview
: 第一轮
: 亚裔面试官,很nice,很详细问了当前project,问到许多细节的处理
: 算法题 reverse words in a sentence.
: "It is good"--------->"good is It"
: 很简单,写完的时候有个bug,让我检查 发现了改了
: 然后又提示把reverse string的函数单独提出来
: follow question问能不能处理 string 前后中许多空白
: 我说可以 他觉得不可以 我们一块走了一遍code 可以
: 结束了

avatar
l*b
30
Q2: three points that satisfy a triangle inequality will form a triangle,
pick a 4-th point not on the same plane, it will decide the orintation of
the space. They can be fit into the space in arbitrary orientation.
Coordinates of all other points can be determined by their distance to these
four points.
But it's still hard to figure out their exact coordinates. You will need to
dervive some formulas using some area, volumn, distance to get their
coordinates more efficiently. I guess.
Edit: with coordinate of 4 points given and distance to them, coordinate of
another point is given by (x,y,z), you can reduce it to a 3 variable 3
equation linear system. So it will be solve in linear time. :)

【在 s*******r 的大作中提到】
: 那是我记错了 oj里确实没有
: 可能是在leetcode的blog entry里或者别处看到的
: 嗯 Q2我只能当数学题目来想想
: 下次再有这样问的烙印我就直接投降主动让他move on next...

avatar
s*r
31
果然大牛 说的名词我都不认识
说说N^4的解法?

【在 f*****e 的大作中提到】
: Q2只想到了N^4的解法,Q3 isomophism,先coarse filter,再finer filter。
avatar
f*e
32
每加入一个点i+1,用1至i中的3个点可以确定i+1只有两个位置,这个耗费常数时间c,
然后确定它与已经加入的所有点1至i的距离是否满足矩阵。所以是
sum(1+2+...+N)=O(N^2)

【在 s*******r 的大作中提到】
: 果然大牛 说的名词我都不认识
: 说说N^4的解法?

avatar
f*e
33
Q3用凸包比较好做,记录polar angle和distance。也只要O(N^2)

【在 f*****e 的大作中提到】
: 每加入一个点i+1,用1至i中的3个点可以确定i+1只有两个位置,这个耗费常数时间c,
: 然后确定它与已经加入的所有点1至i的距离是否满足矩阵。所以是
: sum(1+2+...+N)=O(N^2)

avatar
p*2
34
LZ是ACMer吗?怎么电面这么难呢?
avatar
A*o
35
luckynoob gave an answer to Q2, not repeating ,,,
avatar
s*r
36
差距啊 极坐标我现在也只记得一个名词了 回去复习去!

【在 f*****e 的大作中提到】
: Q3用凸包比较好做,记录polar angle和distance。也只要O(N^2)
avatar
s*r
37
嗯 我的思路也是这样 不过没有你想的这么细
可能口语不行吧 烙印都没耐心听我把坐标系建立完

these
to
of

【在 l*******b 的大作中提到】
: Q2: three points that satisfy a triangle inequality will form a triangle,
: pick a 4-th point not on the same plane, it will decide the orintation of
: the space. They can be fit into the space in arbitrary orientation.
: Coordinates of all other points can be determined by their distance to these
: four points.
: But it's still hard to figure out their exact coordinates. You will need to
: dervive some formulas using some area, volumn, distance to get their
: coordinates more efficiently. I guess.
: Edit: with coordinate of 4 points given and distance to them, coordinate of
: another point is given by (x,y,z), you can reduce it to a 3 variable 3

avatar
l*b
38
电面时间不多呀, 这个坐下来自己想肯定能搞清楚的, 面起来就不好说了, 感觉.

【在 s*******r 的大作中提到】
: 嗯 我的思路也是这样 不过没有你想的这么细
: 可能口语不行吧 烙印都没耐心听我把坐标系建立完
:
: these
: to
: of

avatar
x*0
39
mark
avatar
r*n
40
Q2 idea
显然坐标系不是唯一的,
让第一个点是原点(0,0,0)
让第二个点在x axis上面,这样第二个点的坐标是(d12,0,0),同时确立了x axis的方向
让第三个点在x-y平面上面,这样第三个点的坐标可以表示为(x3,y3,0),通过d13,d23
解一个2元2次方程,并让y3取正值,这样相当于确立了y-axis方向(如果y3取负值,y-
axis就反向而已)(这里有个细节,如果1,2,3三个点在同一线上,那么是无法确立y
axis,这个时候就要找下面一个点了)
有了x axis和y axis,z axis就自动确立了。
剩下来的点的坐标假设为(a,b,c),通过列方程求解。
avatar
p*e
41
Q2估计老印也觉得不适合作为面试题,就move on了
avatar
r*n
42
Q3 idea
通过Q2,我们可以从M1,M2算出每个点在两个坐标系的坐标。通过M1算出来的坐标是ui
,i = 1, ..., n,同理通过M2算出来的坐标是vi。Q3实际上等同于问有没有线性变换
把一个坐标系换成另外一个坐标系,or equivalently does there exist a matrix A
such that
A*ui = vj for some i,j = 1,...,n
A represents rotation and the translation (means swap of indices?) is
captured by the the fact i,j could be different.
但是这个怎么解,还没想出来。
LZ面的职位不是纯码工吧
avatar
A*o
43
Q2的结果可以用来解Q3,O(n^2)
avatar
s*l
44
Q3:
求和,平方求和,三次方求和,...
或者 每项d_(ij)换成exp(-d_(ij)*d_(ij)/sigma), 任取sigma, 再求和,
如果对两个矩阵用以上的运算得到的和都一样的话,可以肯定两个点集是isometry(旋
转平移)
Keywords: euclidean distance matrix, isometry-invariant
avatar
s*l
45

或者检查两组特征值是否一致,不过复杂度(N^3)应该比上面的求和复杂度(N^2)高。

【在 s*********l 的大作中提到】
: Q3:
: 求和,平方求和,三次方求和,...
: 或者 每项d_(ij)换成exp(-d_(ij)*d_(ij)/sigma), 任取sigma, 再求和,
: 如果对两个矩阵用以上的运算得到的和都一样的话,可以肯定两个点集是isometry(旋
: 转平移)
: Keywords: euclidean distance matrix, isometry-invariant

avatar
a*g
46
请问面的是什么职位,是SE吗?还是他家data scientist也是这么面?谢谢了
avatar
c*t
47
弱问一下Q3,就算所有distance都一样,也不一定是相同点集合啊
极端一点
矩阵M 0 1
矩阵N 0 1
M和N能代表相同两个点吗?

【在 s*******r 的大作中提到】
: 两轮 phone interview
: 第一轮
: 亚裔面试官,很nice,很详细问了当前project,问到许多细节的处理
: 算法题 reverse words in a sentence.
: "It is good"--------->"good is It"
: 很简单,写完的时候有个bug,让我检查 发现了改了
: 然后又提示把reverse string的函数单独提出来
: follow question问能不能处理 string 前后中许多空白
: 我说可以 他觉得不可以 我们一块走了一遍code 可以
: 结束了

avatar
s*r
48
改个名 准备整理下其他的发过来

【在 s*******r 的大作中提到】
: 两轮 phone interview
: 第一轮
: 亚裔面试官,很nice,很详细问了当前project,问到许多细节的处理
: 算法题 reverse words in a sentence.
: "It is good"--------->"good is It"
: 很简单,写完的时候有个bug,让我检查 发现了改了
: 然后又提示把reverse string的函数单独提出来
: follow question问能不能处理 string 前后中许多空白
: 我说可以 他觉得不可以 我们一块走了一遍code 可以
: 结束了

avatar
g*r
49
这也太难了
avatar
g*s
50
Q3我也有同样的疑问。
distance矩阵只包含local信息。就算M1 M2完全一样,也只是说明可能两个set组成的
多边形形状一样。 你对这个多边形做任意旋转或平移M都不会变把?

【在 c********t 的大作中提到】
: 弱问一下Q3,就算所有distance都一样,也不一定是相同点集合啊
: 极端一点
: 矩阵M 0 1
: 矩阵N 0 1
: M和N能代表相同两个点吗?

avatar
w*m
51
Q2, multiscaling problems in data mining
Q3, first do Q2, then compute its eigen values, eigen vectors, and new
coordinates projected to the new eigen vectors by SVD.
if sorted eigen values different, different
else if sorted eigen vectors different, different
else if sorted new coordinates different, different
else same

【在 s*******r 的大作中提到】
: 两轮 phone interview
: 第一轮
: 亚裔面试官,很nice,很详细问了当前project,问到许多细节的处理
: 算法题 reverse words in a sentence.
: "It is good"--------->"good is It"
: 很简单,写完的时候有个bug,让我检查 发现了改了
: 然后又提示把reverse string的函数单独提出来
: follow question问能不能处理 string 前后中许多空白
: 我说可以 他觉得不可以 我们一块走了一遍code 可以
: 结束了

avatar
x*0
52
mark
avatar
H*r
53
Q1 输入是valid sentence么? Reverse 后是不是需要改大小写? “Good is it"?
有标点符号的情况呢? "Good, is it?" reverse => "It is, good?" or "?It is ,
Good" or "It is good" or "it is Good"?

【在 s*******r 的大作中提到】
: 两轮 phone interview
: 第一轮
: 亚裔面试官,很nice,很详细问了当前project,问到许多细节的处理
: 算法题 reverse words in a sentence.
: "It is good"--------->"good is It"
: 很简单,写完的时候有个bug,让我检查 发现了改了
: 然后又提示把reverse string的函数单独提出来
: follow question问能不能处理 string 前后中许多空白
: 我说可以 他觉得不可以 我们一块走了一遍code 可以
: 结束了

相关阅读
logo
联系我们隐私协议©2024 redian.news
Redian新闻
Redian.news刊载任何文章,不代表同意其说法或描述,仅为提供更多信息,也不构成任何建议。文章信息的合法性及真实性由其作者负责,与Redian.news及其运营公司无关。欢迎投稿,如发现稿件侵权,或作者不愿在本网发表文章,请版权拥有者通知本网处理。