Redian新闻
>
问问关于SPG的2个问题
avatar
问问关于SPG的2个问题# Money - 海外理财
g*x
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()
};
avatar
M*o
2
1. 一般amex的monthly statement是16日出,那么第一个10K bonus是那个时候才能拿
到?
2. SPG能给一个免费的credit report,这个东西怎么申请啊?
穷人,只能大声说个谢谢了。
avatar
g*e
3
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);

avatar
y*i
4
several days after you make your 1st purchase
http://www.mitbbs.com/article_t0/Money/31842085.html

【在 M******o 的大作中提到】
: 1. 一般amex的monthly statement是16日出,那么第一个10K bonus是那个时候才能拿
: 到?
: 2. SPG能给一个免费的credit report,这个东西怎么申请啊?
: 穷人,只能大声说个谢谢了。

avatar
g*x
5
是国际象棋么?

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

avatar
M*o
6
为什么有的人立刻就拿到bonus了,有的人等了很久 什么反应都没的?
avatar
s*n
7
我觉得设计题重要的是思路和考虑问题的全面,和面试官一边扯一边写最好,
avatar
x*l
8
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);

avatar
f*n
9
zan and bless
avatar
l*n
10
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);

avatar
b*e
11
A公司还问过
design一个类似linux文件系统的文件系统,要能完成添加删除列表等基本功能
avatar
d*e
12
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);

avatar
g*x
13
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

avatar
d*e
14
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

avatar
j*a
15
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);

avatar
g*x
16
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

avatar
t*r
17
强力不戴套MARK
avatar
h*8
18
mark
avatar
c*l
19
mark
avatar
d*g
20
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);

avatar
z*a
21
mark
avatar
g*a
22
Mark
有同样困扰
avatar
w*x
23
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

avatar
e*3
24
thanks,awesome
avatar
n*p
25
mark
avatar
r*g
26
mark
avatar
j*w
27
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);

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