由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
JobHunting版 - 发一道FB的题讨论下
相关主题
一个来源于生活的简单数学题google interview question
继续分享G家phone interview题目一个Google面试题
请教leetcode N-Queens II问题一道program challenge的题
请教一道有关随机函数的面试问题问道看到的面试题
问一个面试题问个array in place operation的题目
我花了一个小时才调通过这个程序急问一个面试题,不知该如何回答?请高人给个思路!谢谢!
another google interview question:一个EDA的问题
一道微软题请问A家onsite安排在什么时间比较合适。顺便一面面经。
相关话题的讨论汇总
话题: output话题: move话题: step话题: takes话题: question
进入JobHunting版参与讨论
1 (共1页)
h****n
发帖数: 1093
1
REACH
You are in an infinite 2D grid where you can move in any of the 8 directions
:
(x,y) to
(x+1, y),
(x - 1, y),
(x, y+1),
(x, y-1),
(x-1, y-1),
(x+1,y+1),
(x-1,y+1),
(x+1,y-1)
You are given a sequence of points and the order in which you need to cover
the points. Give the minimum number of steps in which you can achieve it.
You start from the first point.
Example :
Input : [(0, 0), (1, 1), (1, 2)]
Output : 2
It takes 1 step to move from (0, 0) to (1, 1). It takes one more step to
move from (1, 1) to (1, 2).
This question is intentionally left slightly vague. Clarify the question by
trying out a few cases in the “See Expected Output” section.
z*********8
发帖数: 2070
2
vague在哪里?
s*******n
发帖数: 163
3
是严格按照input中的点的顺序吗?如果是,那这题很容易。
难道有隐藏的难点我没看出来?
m****s
发帖数: 1481
4
如果是按照一定的顺序,那可能需要避开排在后面但是在最短路径上的点?
同样道理需要检验会不会在reach一个点之前被后面的点包围了
u******e
发帖数: 758
5
我的想法是算所有点距C(n,2) O(N^2),全排列求最小和O(N!)
a********5
发帖数: 1631
6
说老实话,没太看懂这道题
给定的点集顺序都是固定的,相邻两点之间计算步数是O(1),那应该就是过一遍所有
点集就行?如果这样为什么还要问“min step"?难道不是应该只有一个唯一答案?
还是说前面已经走过的点,后面如果再出现可以直接跳过,每个点只要走一遍?但是题
目里好像不是这个意思啊
1 (共1页)
进入JobHunting版参与讨论
相关主题
请问A家onsite安排在什么时间比较合适。顺便一面面经。问一个面试题
这题应该是道简单题我花了一个小时才调通过这个程序
感觉这是一道经典题another google interview question:
问一道算法题一道微软题
一个来源于生活的简单数学题google interview question
继续分享G家phone interview题目一个Google面试题
请教leetcode N-Queens II问题一道program challenge的题
请教一道有关随机函数的面试问题问道看到的面试题
相关话题的讨论汇总
话题: output话题: move话题: step话题: takes话题: question