注册一亩三分地论坛,查看更多干货!
您需要 登录 才可以下载或查看附件。没有帐号?注册账号 
x
Sorry my Chinese is really bad. Posting in English.
I got this question in a phone interview with a software developer from the US. The position I'm applying for is in Canada.
Copied from this:
PLEASE use DFS. It's basically calculating the number of differences between 2 n-ary trees.
Question:At DoorDash, menus are updated daily even hourly to keep them up-to-date. Each menu can be regarded as a tree. A menu can have many categories; each category can have many menu_items; each menu_item can have many item_extras; An item_extra can have many item_extra_options…
class Node {
String key;
int value;
/ \
b(2, T) c(3, T)
/ \ \
d(4, T) e(5, T) g(7, T)
New tree
a(1, T)
/ \
b(2, T) c(3, T)
/ | \ \
d(4, T) e(5, T) f(6, T) g(7, F) |