由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
JobHunting版 - 请教一道算法题,周二面试,急!
相关主题
讨论一道算法找工作的 reimbursement
我们公司的面试方式改了[合集] 贡献一道it面试题
问一道车辆归位的算法题电面后,hr发了两道题,请教高手
请教一道组合题来做一道有趣的题目
一道动态规划题请教一道题
Problem with recruiter找不到一道题目了
Problem with recruiter问一道旧题
Urgent question, please help!求教一道ms的题目
相关话题的讨论汇总
话题: cars话题: lot话题: 算法话题: move
进入JobHunting版参与讨论
1 (共1页)
a***o
发帖数: 19
1
我这周二有个面试,请大家帮忙看看下面这道算法题,谢谢!
You are a parking lot attendant in a lot that has one open spot, and you
want to move the cars from their original positions into a new arrangement.
Create a program that will print out instructions on how to move the cars
most efficiently.
l*****a
发帖数: 14598
2
parking lot有什么限制条件
比方随便两辆车,都可以通过那个open lot交换嘛?

arrangement.
cars

【在 a***o 的大作中提到】
: 我这周二有个面试,请大家帮忙看看下面这道算法题,谢谢!
: You are a parking lot attendant in a lot that has one open spot, and you
: want to move the cars from their original positions into a new arrangement.
: Create a program that will print out instructions on how to move the cars
: most efficiently.

v********w
发帖数: 136
3
好像就是只能swap的排序问题,从第一个车位起,不断的把这个车位上的车换到应该的
位置,对的话就
看下一个

arrangement.
cars

【在 a***o 的大作中提到】
: 我这周二有个面试,请大家帮忙看看下面这道算法题,谢谢!
: You are a parking lot attendant in a lot that has one open spot, and you
: want to move the cars from their original positions into a new arrangement.
: Create a program that will print out instructions on how to move the cars
: most efficiently.

d**e
发帖数: 6098
4
如果是telnet,本版 48877 版
如果是 web, http://mitbbs.com/article_t/JobHunting/31550447.html
据里面讨论的跟这个题相似

.

【在 a***o 的大作中提到】
: 我这周二有个面试,请大家帮忙看看下面这道算法题,谢谢!
: You are a parking lot attendant in a lot that has one open spot, and you
: want to move the cars from their original positions into a new arrangement.
: Create a program that will print out instructions on how to move the cars
: most efficiently.

b******v
发帖数: 1493
5
假如有三辆车 1, 5, 7 ,它们的新位置分别为5, 7, 1,
则可以这样做(其中V表示空位)
1->V
7->1
5->7
V->5
假设原位置为a[0..(N-1)], 对应的新位置为b[0..(N-1)]
则基本上只要对每个类似上面例子中的圈做类似操作即可

.

【在 a***o 的大作中提到】
: 我这周二有个面试,请大家帮忙看看下面这道算法题,谢谢!
: You are a parking lot attendant in a lot that has one open spot, and you
: want to move the cars from their original positions into a new arrangement.
: Create a program that will print out instructions on how to move the cars
: most efficiently.

a***o
发帖数: 19
6
非常感谢,我想得太复杂了。
1 (共1页)
进入JobHunting版参与讨论
相关主题
求教一道ms的题目一道动态规划题
分享一道Amazon面试设计题Problem with recruiter
在看大数据量的题,问一道简单的分布式处理Problem with recruiter
一道老题Urgent question, please help!
讨论一道算法找工作的 reimbursement
我们公司的面试方式改了[合集] 贡献一道it面试题
问一道车辆归位的算法题电面后,hr发了两道题,请教高手
请教一道组合题来做一道有趣的题目
相关话题的讨论汇总
话题: cars话题: lot话题: 算法话题: move