由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
JobHunting版 - Amazon面试之设计题讨论
相关主题
Amazon的zoo的设计问题C++ Q39: throw new (C1)
design elevator 问题求解关于polymorphism和overloading
问个电梯系统设计的问题amazon intern一共几面, 加面经
大家讲讲OOD 问题怎么准备电梯问题设计题 谁给个比较好的设计方法啊
请问OOD的问题应该如何回答 有哪些资料可以参考电梯设计题
Amazon 的问题谁能给个“电梯设计”题的终极解答?
这个水管题出的不对吧?报个Box Offer,和面经
再贴设计电梯Google 电面
相关话题的讨论汇总
话题: elevator话题: table话题: milk话题: yogurt话题: stop
进入JobHunting版参与讨论
1 (共1页)
g*****x
发帖数: 799
1
以前曾经去过一次西雅图,过几天又要去了
感觉面试的时候设计题是我的软肋,答的时候总是磕磕绊绊的
想跟大家一起来讨论一下
以下列出一些我自己遇到过的或者在网上见过的题
欢迎大家讨论,补充
1. DB design of sys that enable paid customers to park, customers can either
book online beforehead or park at empty positions that are not booked
table Lot(id(pk), position, occupied);
table Customer(id(pk), name, phone);
table Lot_Customer(lid(pk), cid, start_time(pk), end_time);
2. OOD deck of cards
class Card {
enum Suits suit;
int value;
// getters & setters(check if suit & value are valid)
};
class Deck{
list cards;
Deck();
void shuffle();
Card front();
};
3. DB design of fridge inventory, can store products of different kinds,
different amounts and measurements/units (1 gallon milk, 2 dozen eggs),
expiration date (面试官不断加要求,搞得乱七八糟)
table Inventory(pid, exp_date, quantity, measurement)
table Product(pid, name)
table Type(tid, name, related_tid, relationship) // e.g. A-brand reduced fat
milk is Milk, B-brand full fat milk is also Milk, C-brand strawberry yogurt
is Yogurt, D-brand peach yogurt is also Yogurt, Milk and Yogurt are both
subtype of Dairy
table ProdType(tid, pid) // n to n relationship, each product can fall in
many types
table Measurement(pid, valid_measurement) // e.g. milk can be measured by "
gallon", "box", but not "bag"
4. OOD of a zoo, different types of animals (carnivores/herbivores,
hierarchical inheritance), cages (cage type, cage size, number of each type
of animal can be in the same cage), some of them cannot be put in the same
cage, need predator and prey relationships, what if, for instance, lion eat
1million different animals? i told him i can just put Herbivores in the prey
list of lion. he then asked what if mouse is herbivore, and lions don't eat
mice? (此题也是不断加要求,搞得相当乱)
5. OOD of elevator (道听途说,不知道原题有哪些要求)
class Elevator {
int curr_floor;
int capacity; // check if it's over-weight
int direction; // up, down, stop
list stop_floors;
void addStop(); // when button is pressed inside elevator
bool isStop(); // check if the elevator should stop at current floor
according to elevator algorithm
bool isOverweight();
void stopElev(); // open and close door, check weight, delete stop from
stop_floors list
};
class ElevGroup {
vector elevators;
list stop_floors;
void addStop(); // when button is pressed outside elevator
void schedule(); // pick an elevator and call elev.stopElev()
};
g**e
发帖数: 6127
2
mark一下
还有著名的design chess game

either
fat
yogurt
type
eat
prey
eat

【在 g*****x 的大作中提到】
: 以前曾经去过一次西雅图,过几天又要去了
: 感觉面试的时候设计题是我的软肋,答的时候总是磕磕绊绊的
: 想跟大家一起来讨论一下
: 以下列出一些我自己遇到过的或者在网上见过的题
: 欢迎大家讨论,补充
: 1. DB design of sys that enable paid customers to park, customers can either
: book online beforehead or park at empty positions that are not booked
: table Lot(id(pk), position, occupied);
: table Customer(id(pk), name, phone);
: table Lot_Customer(lid(pk), cid, start_time(pk), end_time);

g*****x
发帖数: 799
3
是国际象棋么?

【在 g**e 的大作中提到】
: mark一下
: 还有著名的design chess game
:
: either
: fat
: yogurt
: type
: eat
: prey
: eat

s******n
发帖数: 65
4
我觉得设计题重要的是思路和考虑问题的全面,和面试官一边扯一边写最好,
x*****l
发帖数: 148
5
mark

以前曾经去过一次西雅图,过几天又要去了
感觉面试的时候设计题是我的软肋,答的时候总是磕磕绊绊的
想跟大家一起来讨论一下
以下列出一些我自己遇到过的或者在网上见过的题
欢迎大家讨论,补充
1. DB design of sys that enable paid customers to park, customers can either
book online beforehead or park at empty positions that are not booked
table Lot(id(pk), position, occupied);
table Customer(id(pk), name, phone);
table Lot_Customer(lid(pk), cid, start_time(pk), end_time);
2. OOD deck of cards
class Card {
enum Suits suit;
int value;
// getters & setters(check if suit & value are valid)
};
class Deck{
list cards;
Deck();
void shuffle();
Card front();
};
3. DB design of fridge inventory, can store products of different kinds,
different amounts and measurements/units (1 gallon milk, 2 dozen eggs),
expiration date (面试官不断加要求,搞得乱七八糟)
table Inventory(pid, exp_date, quantity, measurement)
table Product(pid, name)
table Type(tid, name, related_tid, relationship) // e.g. A-brand reduced fat
milk is Milk, B-brand full fat milk is also Milk, C-brand strawberry yogurt
is Yogurt, D-brand peach yogurt is also Yogurt, Milk and Yogurt are both
subtype of Dairy
table ProdType(tid, pid) // n to n relationship, each product can fall in
many types
table Measurement(pid, valid_measurement) // e.g. milk can be measured by "
gallon", "box", but not "bag"
4. OOD of a zoo, different types of animals (carnivores/herbivores,
hierarchical inheritance), cages (cage type, cage size, number of each type
of animal can be in the same cage), some of them cannot be put in the same
cage, need predator and prey relationships, what if, for instance, lion eat
1million different animals? i told him i can just put Herbivores in the prey
list of lion. he then asked what if mouse is herbivore, and lions don't eat
mice? (此题也是不断加要求,搞得相当乱)
5. OOD of elevator (道听途说,不知道原题有哪些要求)
class Elevator {
int curr_floor;
int capacity; // check if it's over-weight
int direction; // up, down, stop
list stop_floors;
void addStop(); // when button is pressed inside elevator
bool isStop(); // check if the elevator should stop at current floor
according to elevator algorithm
bool isOverweight();
void stopElev(); // open and close door, check weight, delete stop from
stop_floors list
};
class ElevGroup {
vector elevators;
list stop_floors;
void addStop(); // when button is pressed outside elevator
void schedule(); // pick an elevator and call elev.stopElev()
};

【在 g*****x 的大作中提到】
: 以前曾经去过一次西雅图,过几天又要去了
: 感觉面试的时候设计题是我的软肋,答的时候总是磕磕绊绊的
: 想跟大家一起来讨论一下
: 以下列出一些我自己遇到过的或者在网上见过的题
: 欢迎大家讨论,补充
: 1. DB design of sys that enable paid customers to park, customers can either
: book online beforehead or park at empty positions that are not booked
: table Lot(id(pk), position, occupied);
: table Customer(id(pk), name, phone);
: table Lot_Customer(lid(pk), cid, start_time(pk), end_time);

f******n
发帖数: 264
6
zan and bless
l********n
发帖数: 684
7
Mark.

either

【在 g*****x 的大作中提到】
: 以前曾经去过一次西雅图,过几天又要去了
: 感觉面试的时候设计题是我的软肋,答的时候总是磕磕绊绊的
: 想跟大家一起来讨论一下
: 以下列出一些我自己遇到过的或者在网上见过的题
: 欢迎大家讨论,补充
: 1. DB design of sys that enable paid customers to park, customers can either
: book online beforehead or park at empty positions that are not booked
: table Lot(id(pk), position, occupied);
: table Customer(id(pk), name, phone);
: table Lot_Customer(lid(pk), cid, start_time(pk), end_time);

b***e
发帖数: 15201
8
A公司还问过
design一个类似linux文件系统的文件系统,要能完成添加删除列表等基本功能
d***e
发帖数: 793
9
For the 1st one, I think for reservation and occupancy, you need 2 separate
tables. Otherwise you need bit field to control the type in your
Lot_Customer table. Occupied field is not necessary in Lot table.
table Reservation(lid, cid, start_time, end_time);
table Occupancy(lid, cid, start_time, end_time);

either

【在 g*****x 的大作中提到】
: 以前曾经去过一次西雅图,过几天又要去了
: 感觉面试的时候设计题是我的软肋,答的时候总是磕磕绊绊的
: 想跟大家一起来讨论一下
: 以下列出一些我自己遇到过的或者在网上见过的题
: 欢迎大家讨论,补充
: 1. DB design of sys that enable paid customers to park, customers can either
: book online beforehead or park at empty positions that are not booked
: table Lot(id(pk), position, occupied);
: table Customer(id(pk), name, phone);
: table Lot_Customer(lid(pk), cid, start_time(pk), end_time);

g*****x
发帖数: 799
10
not sure about that, actually, i don't remember the question clearly. but if
he meant non-registered customers can come and park at arbitrary not booked
position and leave whenever they want, so i thought an occupied field would
be enough

separate

【在 d***e 的大作中提到】
: For the 1st one, I think for reservation and occupancy, you need 2 separate
: tables. Otherwise you need bit field to control the type in your
: Lot_Customer table. Occupied field is not necessary in Lot table.
: table Reservation(lid, cid, start_time, end_time);
: table Occupancy(lid, cid, start_time, end_time);
:
: either

相关主题
Amazon 的问题C++ Q39: throw new (C1)
这个水管题出的不对吧?关于polymorphism和overloading
再贴设计电梯amazon intern一共几面, 加面经
进入JobHunting版参与讨论
d***e
发帖数: 793
11
in that case how do you handle double booking? you might book for morning,
I might book for afternoon.:)

but if
booked
would

【在 g*****x 的大作中提到】
: not sure about that, actually, i don't remember the question clearly. but if
: he meant non-registered customers can come and park at arbitrary not booked
: position and leave whenever they want, so i thought an occupied field would
: be enough
:
: separate

j*******a
发帖数: 61
12
mark

either

【在 g*****x 的大作中提到】
: 以前曾经去过一次西雅图,过几天又要去了
: 感觉面试的时候设计题是我的软肋,答的时候总是磕磕绊绊的
: 想跟大家一起来讨论一下
: 以下列出一些我自己遇到过的或者在网上见过的题
: 欢迎大家讨论,补充
: 1. DB design of sys that enable paid customers to park, customers can either
: book online beforehead or park at empty positions that are not booked
: table Lot(id(pk), position, occupied);
: table Customer(id(pk), name, phone);
: table Lot_Customer(lid(pk), cid, start_time(pk), end_time);

g*****x
发帖数: 799
13
just insert in Lot_Customer if that lot is not booked for the time slot

【在 d***e 的大作中提到】
: in that case how do you handle double booking? you might book for morning,
: I might book for afternoon.:)
:
: but if
: booked
: would

t**r
发帖数: 3428
14
强力不戴套MARK
h**********8
发帖数: 267
15
mark
c****l
发帖数: 1280
16
mark
d**********g
发帖数: 1713
17
mark

either

【在 g*****x 的大作中提到】
: 以前曾经去过一次西雅图,过几天又要去了
: 感觉面试的时候设计题是我的软肋,答的时候总是磕磕绊绊的
: 想跟大家一起来讨论一下
: 以下列出一些我自己遇到过的或者在网上见过的题
: 欢迎大家讨论,补充
: 1. DB design of sys that enable paid customers to park, customers can either
: book online beforehead or park at empty positions that are not booked
: table Lot(id(pk), position, occupied);
: table Customer(id(pk), name, phone);
: table Lot_Customer(lid(pk), cid, start_time(pk), end_time);

z*********a
发帖数: 320
18
mark
g*******a
发帖数: 149
19
Mark
有同样困扰
w****x
发帖数: 136
20
Agree. Each transaction is very flexible and could be M:M.
For any client faced system, you need to list a transaction as an
independent table first, and then consider M:M.

separate

【在 d***e 的大作中提到】
: For the 1st one, I think for reservation and occupancy, you need 2 separate
: tables. Otherwise you need bit field to control the type in your
: Lot_Customer table. Occupied field is not necessary in Lot table.
: table Reservation(lid, cid, start_time, end_time);
: table Occupancy(lid, cid, start_time, end_time);
:
: either

相关主题
电梯问题设计题 谁给个比较好的设计方法啊报个Box Offer,和面经
电梯设计题Google 电面
谁能给个“电梯设计”题的终极解答?[合集] 报一个offer,并推荐一个very good interview coding 网站
进入JobHunting版参与讨论
e******3
发帖数: 11
21
thanks,awesome
n********p
发帖数: 708
22
mark
r*******g
发帖数: 1335
23
mark
j*****w
发帖数: 22
24
Amazon jobs:
http://myguiding.com/viewforum.php?f=97

either

【在 g*****x 的大作中提到】
: 以前曾经去过一次西雅图,过几天又要去了
: 感觉面试的时候设计题是我的软肋,答的时候总是磕磕绊绊的
: 想跟大家一起来讨论一下
: 以下列出一些我自己遇到过的或者在网上见过的题
: 欢迎大家讨论,补充
: 1. DB design of sys that enable paid customers to park, customers can either
: book online beforehead or park at empty positions that are not booked
: table Lot(id(pk), position, occupied);
: table Customer(id(pk), name, phone);
: table Lot_Customer(lid(pk), cid, start_time(pk), end_time);

h******n
发帖数: 68
25
mark, 赞
u***q
发帖数: 21
26
mark too
1 (共1页)
进入JobHunting版参与讨论
相关主题
Google 电面请问OOD的问题应该如何回答 有哪些资料可以参考
[合集] 报一个offer,并推荐一个very good interview coding 网站Amazon 的问题
amazon 电面这个水管题出的不对吧?
Java developer Opening(Junior) at MD再贴设计电梯
Amazon的zoo的设计问题C++ Q39: throw new (C1)
design elevator 问题求解关于polymorphism和overloading
问个电梯系统设计的问题amazon intern一共几面, 加面经
大家讲讲OOD 问题怎么准备电梯问题设计题 谁给个比较好的设计方法啊
相关话题的讨论汇总
话题: elevator话题: table话题: milk话题: yogurt话题: stop