📣 黑五网一特惠|VIP一年通行证5折,蓝莓、Offer多多同步特惠
回复: 1
跳转到指定楼层
上一主题 下一主题
收起左侧

Google 新鲜店面phone screening

全局:

2022(4-6月) 码农类General 硕士 全职@google - Other - 技术电面  | 😃 Positive 😐 Average | Pass | 在职跳槽

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

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

x
周一(05/23)新鲜的店面:题目大概意思是要进行gmail和其他邮箱系统数据导入,其他系统的邮箱系统是用folde
您好!
本帖隐藏的内容需要积分高于 188 才可浏览
您当前积分为 0。
使用VIP即刻解锁阅读权限或查看其他获取积分的方式
游客,您好!
本帖隐藏的内容需要积分高于 188 才可浏览
您当前积分为 0。
VIP即刻解锁阅读权限 或 查看其他获取积分的方式
Unlock interview details and practice with AI
Popular Interview Questions from Top Companies
a:
  1. /**
  2. *
  3. * // Sample input:
  4. *
  5. * folders = [
  6. * {id: 27, parentId: 15, name: 'projects'},
  7. * {id: 81, parentId: 27, name: 'novel'},
  8. * {id: 15, parentId: -1, name: 'personal'}, // a parentId of -1 means root, some of the variant using 0 to represent root.
  9. * {id: 35, parentId: 27, name: 'blog'},
  10. * ]
  11. *
  12. * // Sample output:
  13. *
  14. * labels = [
  15. * displayName: 'projects', path: 'personal/projects',
  16. * displayName: 'novel', path:'personal/projects/novel',
  17. * displayName: 'personal', path:'personal',
  18. * displayName: 'blog', path: 'personal/projects/blog',
  19. * ]
  20. * */
  21. //要求实现数据的导入
  22. List<Label> folderToLabels(List<Folder> folders){
  23. // write your excellent code here
  24. }
复制代码
求加米看帖子,谢谢。

评分

参与人数 4大米 +17 收起 理由
bryanjhy + 10 给你点个赞!
匿名用户-DPAU1 + 5
shichsh07 + 1 给你点个赞!
jinyaohh + 1 给你点个赞!

查看全部评分


上一篇:谷歌电面第一轮 估计挂经
下一篇:黑车 面经 求问现在黑车offer可以valid多久

本帖被以下淘专辑推荐:

  • · a|主题: 57, 订阅: 0
🔗
shichsh07 2022-5-26 08:37:57 | 只看该作者
全局:
本帖最后由 shichsh07 于 2022-5-25 17:50 编辑

谢谢分享,感觉可以用map 来做cache
  1. map relation;
  2. map cache;
  3. map names;
  4. List<String> res;

  5. for (folder: folders) {
  6.   if (cache.containsKey(folder.id)) res.add(cache.get(folder.id));
  7.   else res.add(helper(folder.id);
  8. }
  9. return res;

  10. public String helper(int id) {
  11.   int parent = relation.get(id);
  12.   if (cache.containsKey(id)) return cache.get(id);
  13.   if (parent == -1) {
  14.     cache.put(id, names.get(id));
  15.     return names.get(id);
  16.   }
  17.   String path = helper(parent) + “/“ + names.get(id);
  18.   cache.put(id, path);
  19.   return path;
  20. }
复制代码
回复

使用道具 举报

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

本版积分规则

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