May 2009 - May 2017 论坛八周年-你的足迹,我的骄傲



查看: 1531|回复: 13


[复制链接] |试试Instant~ |关注本帖
alex2013 发表于 2015-1-12 09:11:34 | 显示全部楼层 |阅读模式

2013(10-12月) 码农类 硕士 全职@Amazon - 内推 - Onsite |Pass


您需要 登录 才可以下载或查看,没有帐号?获取更多干活,快来注册


1, given a string, output character and frequency in decreasing order of frequency (ignore other chars that's not letter)
input: "Aab s."

2D matrix with only 1 and 0, continuous 1 means island, count the number of island

project; goal that you spend long time to achieve
design elevator system.

design data structure that have two methods: check_in, check_out.

check_out - output 1
. Waral 鍗氬鏈夋洿澶氭枃绔,check_out - 2
... (7 times check_out)
check_out - 10
check_out - 2
check_out - 7. 1point 3acres 璁哄潧
check_out - 11

补充内容 (2015-1-12 09:35):
kiviljc 发表于 2015-1-12 09:27:28 | 显示全部楼层
2013 年的面经?
回复 支持 反对

使用道具 举报

 楼主| alex2013 发表于 2015-1-12 09:35:52 | 显示全部楼层

回复 支持 反对

使用道具 举报

angle22 发表于 2015-1-12 11:07:19 | 显示全部楼层
多谢分享,请问最后一道题什么意思,没有check-in就可以check out吗?.1point3acres缃
还有elevator design,网上找了很多,没有什么完整的版本。楼主有的话能分享一下吗?多谢 :)
. more info on
bless you get offer!
回复 支持 反对

使用道具 举报

三吉 发表于 2015-1-13 01:24:57 | 显示全部楼层
回复 支持 反对

使用道具 举报

cgdong2012 发表于 2015-1-13 02:44:55 | 显示全部楼层
同求 elevator design 的思路, 不知道怎么来考虑。-google 1point3acres
还有 第一题那个输出字符和频率的题, 要求时间复杂度是 O(n)吗?
回复 支持 反对

使用道具 举报

刁哥 发表于 2015-1-13 04:28:32 | 显示全部楼层
请问LZ onsite后多久得到消息?
回复 支持 反对

使用道具 举报

nathanwong 发表于 2015-1-14 16:24:23 | 显示全部楼层
最后一题我着实 没看懂 lz 能否再详细点
回复 支持 反对

使用道具 举报

 楼主| alex2013 发表于 2015-1-15 11:28:23 | 显示全部楼层
angle22 发表于 2015-1-12 11:07.
多谢分享,请问最后一道题什么意思,没有check-in就可以check out吗?. from:
还有elevator design,网上找了很多 ...

就是相当于一个装有integer的pool,check out就顺序输出里面已有的数字,check in就是放入数字。. more info on
elevator design网上找了些,然后自己写了一点,基本就是要有bank和car这个类,再加上一个enum表示状态吧:. 1point 3acres 璁哄潧
Design elevator system
An elevator class. The elevator will save the floor information and current floor number. Then judge the current floor number and the number which it will go (from the user operation), and choose to go up or go down.
First there is an elevator class. It has a direction (up, down, stand, maintenance), a current floor and a list of floor requests sorted in the direction. It receives request from this elevator.
Then there is a bank. It contains the elevators and receives the requests from the floors. These are scheduled to all active elevators (not in maintenance).
The scheduling will be like:
if available pick a standing elevator for this floor.
else pick an elevator moving to this floor.
else pick a standing elevator on an other floor.
else pick the elevator with the lowest load.
Each elevator has a set of states.
Maintenance: the elevator does not react to external signals (only to its own signals).
Stand: the elevator is fixed on a floor. If it receives a call. And the elevator is on that floor, the doors open. If it is on another floor, it moves in that direction.
Up: the elevator moves up. Each time it reaches a floor, it checks if it needs to stop. If so it stops and opens the doors. It waits for a certain amount of time and closes the door (unless someting is moving through them. Then it removes the floor from the request list and checks if there is another request. If so the elevator starts moving again. If not it enters the state stand.
Down: like up but in reverse direction..鏈枃鍘熷垱鑷1point3acres璁哄潧
enum State {Standing, Up, Down};. more info on

class Car { 鏉ユ簮涓浜.涓夊垎鍦拌鍧.
     private List<Integer> requests;
     private int floor;
     private State state;

     public void addRequest(int floor);. 鐣欏鐢宠璁哄潧-涓浜╀笁鍒嗗湴
     public int getFloor();. 1point 3acres 璁哄潧
     public void move();
     public State getState();

class Bank {
     private List<Car> cars;

     public void request(int floor) {
          boolean isPicked = false;
          Car standCar = null;
          int standMin = Integer.MAX_VALUE;. visit for more.
          Car moveToCar = null;. Waral 鍗氬鏈夋洿澶氭枃绔,
          int moveToMin = Integer.MAX_VALUE;
          Car moveAwayCar = null;
          int moveAwayMin = Integer.MAX_VALUE;-google 1point3acres

          for (Car car : cars) {
               if (car.getState() == State.Stand) {
                    if (car.getFloor() == floor) {
                         isPicked = true;.
                    standCar = Math.abs(car.getFloor() - floor) < standMin ? car : standCar;
               } else {
                    if ((car.getState() == State.Up && car.getFloor() < floor) ||
                              (car.getState() == State.Down && car.getFloor() > floor)) {. more info on
                         moveToCar = Math.abs(car.getFloor() - floor) < moveToMin ? car : moveToCar;
                    } else {. 涓浜-涓夊垎-鍦帮紝鐙鍙戝竷
                         moveAwayCar = Math.abs(car.getFloor() - floor) < moveAwayMin ? car : moveAwayCar;
          }. 涓浜-涓夊垎-鍦帮紝鐙鍙戝竷
-google 1point3acres
          if (!isPicked) {
               if (moveToCar != null) {
               } else if (standCar != null) {
               } else {
回复 支持 反对

使用道具 举报

 楼主| alex2013 发表于 2015-1-15 11:29:48 | 显示全部楼层
三吉 发表于 2015-1-13 01:24

回复 支持 反对

使用道具 举报

 楼主| alex2013 发表于 2015-1-15 11:30:07 | 显示全部楼层
cgdong2012 发表于 2015-1-13 02:44 鏉ユ簮涓浜.涓夊垎鍦拌鍧.
同求 elevator design 的思路, 不知道怎么来考虑。
还有 第一题那个输出字符和频率的题, 要求时间复杂度 ...
. Waral 鍗氬鏈夋洿澶氭枃绔,
回复 支持 反对

使用道具 举报

 楼主| alex2013 发表于 2015-1-15 11:30:33 | 显示全部楼层
刁哥 发表于 2015-1-13 04:28
请问LZ onsite后多久得到消息?

回复 支持 反对

使用道具 举报

 楼主| alex2013 发表于 2015-1-15 11:30:41 | 显示全部楼层
nathanwong 发表于 2015-1-14 16:24
最后一题我着实 没看懂 lz 能否再详细点

回复 支持 反对

使用道具 举报

nathanwong 发表于 2015-1-15 15:19:51 | 显示全部楼层
alex2013 发表于 2015-1-15 11:30

回复 支持 反对

使用道具 举报



一亩三分地推荐上一条 /5 下一条

手机版|小黑屋|一亩三分地论坛声明 ( 沪ICP备11015994号 )

custom counter

GMT+8, 2017-5-28 11:31

Powered by Discuz! X3

© 2001-2013 Comsenz Inc. Design By HUXTeam

快速回复 返回顶部 返回列表