📣 独立日限时特惠: VIP通行证立减$68
回复: 8
跳转到指定楼层
上一主题 下一主题
收起左侧

一个小时前刚结束的BB电面

全局:

2016(4-6月) 码农类General 博士 全职@bloomberg - 内推 - 技术电面  | | Other | 应届毕业生

注册一亩三分地论坛,查看更多干货!

您需要 登录 才可以下载或查看附件。没有帐号?注册账号

x
呜呜呜,一个小时前刚结束的BB电面,不堪回首

上来印度小哥介绍了下自己哪个部门干啥的,然后问了我的project, why BB等。
直接HackRanker码题。上来就让design class Family Tree,说一个家庭有1-2个人,每个人都有0-2个children,让开始设计class. 一脸懵逼,说好的Two sum呢
您好!
本帖隐藏的内容需要积分高于 188 才可浏览
您当前积分为 0。
使用VIP即刻解锁阅读权限或查看其他获取积分的方式
游客,您好!
本帖隐藏的内容需要积分高于 188 才可浏览
您当前积分为 0。
VIP即刻解锁阅读权限查看其他获取积分的方式
Unlock interview details and practice with AI
Curated Interview Questions from Top Companies
if" smilieid="85" border="0" alt="" />。Move on了。。太挫了。准备的算法题全没用到。。


补充内容 (2016-5-17 23:53):
过了,在安排onsite......

评分

参与人数 3大米 +50 收起 理由
RRYYN + 5 感谢分享!
夏虫不知雪花 + 40
Rain + 5 感谢分享!

查看全部评分


上一篇:Uber Onsite (Full Stack非主流面试)
下一篇:脸书513新出炉电面
🔗
blackrose 2016-5-13 23:17:40 | 只看该作者
全局:
不同公司,相似经历,继续加油!希望好运来!
回复

使用道具 举报

🔗
 楼主| Littles 2016-5-13 23:20:47 | 只看该作者
全局:
blackrose 发表于 2016-5-13 23:17
不同公司,相似经历,继续加油!希望好运来!

心好累啊。小哥估计觉得我是智障。我一停顿他就开始巴拉巴拉地提醒,根本不给我时间考虑。
加油加油!
回复

使用道具 举报

🔗
llatjob 2016-5-14 02:36:09 | 只看该作者
全局:
这个算是二叉树变种吧,只是每个node可以有n 个children node,有两个parent node,然后就行了。一个family就是一个root node。查在不在family就是查在不在tree里面。查cousion就是查到common ancestor的距离是一样的
回复

使用道具 举报

🔗
llatjob 2016-5-14 02:36:59 | 只看该作者
全局:
llatjob 发表于 2016-5-14 02:36
这个算是二叉树变种吧,只是每个node可以有n 个children node,有两个parent node,然后就行了。一个family ...

或者再引入spouse
回复

使用道具 举报

🔗
 楼主| Littles 2016-5-14 06:47:02 | 只看该作者
全局:
llatjob 发表于 2016-5-14 02:36
这个算是二叉树变种吧,只是每个node可以有n 个children node,有两个parent node,然后就行了。一个family ...

一开始写的时候根本没有提到后面的一些用法,所以不知道他想干嘛。
查cousin还要查是不是本人,是不是兄弟姐妹。
回复

使用道具 举报

🔗
tianf 2016-5-22 07:19:28 | 只看该作者
全局:
这题有没有比较简单的方法?要用到inheritance吗?
回复

使用道具 举报

🔗
飞飞 2016-6-5 14:07:38 | 只看该作者
全局:
我觉的这题要用Unionfind吗?找cousin。。。 一听到题,首先问,你要实现什么function。。。。
回复

使用道具 举报

🔗
Jailf 2016-6-29 08:06:28 | 只看该作者
全局:
大概写了一个,因为Person和Family没有什么关系,就用了两个独立的类,Family的constructor暂时空着了。
通过查哈希表来判断 一个人是否是family的成员,但是有可能有重名的情况,所以就是用了一个名字对应一个set的结构。
cousion的话就是判断两个人的爸妈是不是sibiling

class Person
{
public:
        Person* father;
        Person* mother;
        vector<Person*> children;
        string name;

        Person(string n, Person* f, Person* m, vector<Person*> c):name(n), father(f), mother(m), children(c){}
        ~Person();

};

class Family
{
public:
        Family();
        ~Family();

        bool isMember(Person* p){
                //search in the hasp map;
                if (members.find(p->name) != members.end()){
                        return members[p->name].find(p) != members[p->name].end();
                }
                else
                        return false;
        }

        bool areCousin(Person* a, Person* b){
                //their parents are brother or sister.
                return areSibling(a->mother, b->father) || areSibling(a->mother, b->mother) || areSibling(a->father, b->father) || areSibling(a->father, b->mother);
        }

        bool areSibling(Person *a, Person* b){
                //if they have same parent;
                if (a->father == b->father && a->mother == b->mother)
                        return true;
                else
                        return false;
        }

private:
        map<string, set<Person*>> members;  //same name
        Person *root1, *root2;
};
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册账号
隐私提醒:
  • ☑ 禁止发布广告,拉群,贴个人联系方式:找人请去🔗同学同事飞友,拉群请去🔗拉群结伴,广告请去🔗跳蚤市场,和 🔗租房广告|找室友
  • ☑ 论坛内容在发帖 30 分钟内可以编辑,过后则不能删帖。为防止被骚扰甚至人肉,不要公开留微信等联系方式,如有需求请以论坛私信方式发送。
  • ☑ 干货版块可免费使用 🔗超级匿名:面经(美国面经、中国面经、数科面经、PM面经),抖包袱(美国、中国)和录取汇报、定位选校版
  • ☑ 查阅全站 🔗各种匿名方法

本版积分规则

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