回复: 10
跳转到指定楼层
上一主题 下一主题
收起左侧

g家电面

全局:

2014(4-6月) 码农类General 博士 全职@google - 猎头 - 技术电面  | | Other |

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

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

x
继续攒人品。

汇报下前段时间的两轮google电面。recruiter莫名奇妙的联系了,然后莫名奇妙的就安排面试了,人生第一个技术面试,leetcode刷了几个题就上了,太渣已跪
第一个题是瑞士的engineer面的,第二题是伦敦的engi
您好!
本帖隐藏的内容需要积分高于 188 才可浏览
您当前积分为 0。
使用VIP即刻解锁阅读权限或查看其他获取积分的方式
游客,您好!
本帖隐藏的内容需要积分高于 188 才可浏览
您当前积分为 0。
VIP即刻解锁阅读权限 或 查看其他获取积分的方式
Unlock interview details and practice with AI
Curated Interview Questions from Top Companies
种data structure猜了一轮以后,猜中trie。然后要求implement

然后,就没有然后了。





评分

参与人数 2大米 +20 收起 理由
浅浅 + 10 感谢分享!
数字媒体技术 + 10 欢迎来介绍你知道的情况

查看全部评分


上一篇:yelp 面经分享
下一篇:g 最新7月电面

本帖被以下淘专辑推荐:

推荐
Interviwer 2014-9-16 22:35:33 | 只看该作者
全局:
crystal3721 发表于 2014-7-18 20:01
跪求大牛code怎么写~怎么用trie??

用c ++ 写的
  1. #include<iostream>
  2. #include<string>
  3. #include<unordered_map>
  4. using namespace std;

  5. class Trie {

  6. public:
  7.     bool leaf;
  8.     unordered_map<char, Trie*> children;     
  9.     Trie() {
  10.         leaf = false;
  11.     }

  12.     void insert(string word) {
  13.         if(children[word[0]] == NULL) {
  14.             children[word[0]] = new Trie();
  15.         }
  16.    
  17.         if(word.size() == 1) {
  18.             children[word[0]]->leaf = true;
  19.         }else {
  20.             children[word[0]]->insert(word.substr(1));
  21.         }
  22.     }

  23.     bool find(string word) {
  24.         if(children[word[0]] == NULL) {
  25.             return false;
  26.         }

  27.         if(word.size() == 1) {
  28.             return children[word[0]]->leaf;
  29.         }else {
  30.             return children[word[0]]->find(word.substr(1));
  31.         }
  32.     }

  33.     void remove(string word) {
  34.         if(children[word[0]] == NULL) {
  35.             return;
  36.         }

  37.         if(word.size() == 1) {
  38.             children[word[0]]->leaf = false;
  39.             if(children[word[0]]->children.size() == 0) {
  40.                 delete children[word[0]];
  41.             }
  42.         }else{
  43.             children[word[0]]->remove(word.substr(1));
  44.         }
  45.     }
  46. };



  47. int main() {
  48.     Trie* test = new Trie();
  49.     test->insert("whese");
  50.     test->insert("who");
  51.     test->insert("whose");
  52.     test->insert("find");
  53.     test->insert("fin");
  54.     test->remove("fin");
  55.     test->insert("aaa");

  56.     cout << "whese" << test->find("whese") << endl;
  57.     cout << "who" << test->find("who") << endl;
  58.     cout << "whose" << test->find("whose") << endl;
  59.     cout << "what" << test->find("what") << endl;
  60.     cout << "aa" << test->find("aa") << endl;
  61.     cout << "fin" << test->find("fin") << endl;
  62.     cout << "find" << test->find("find") << endl;

  63. }
复制代码
回复

使用道具 举报

🔗
xiatian122 2014-7-18 19:20:42 | 只看该作者
全局:
第二题可以参考leetcode的roman integer
回复

使用道具 举报

🔗
 楼主| crystal3721 2014-7-18 20:01:04 | 只看该作者
全局:
xiatian122 发表于 2014-7-18 19:20
第二题可以参考leetcode的roman integer

跪求大牛code怎么写~怎么用trie??
回复

使用道具 举报

🔗
readman 2014-7-18 20:13:43 | 只看该作者
全局:
您好!
本帖隐藏的内容需要积分高于 100 才可浏览
您当前积分为 0。
使用VIP即刻解锁阅读权限或查看其他获取积分的方式
游客,您好!
本帖隐藏的内容需要积分高于 100 才可浏览
您当前积分为 0。
VIP即刻解锁阅读权限 或 查看其他获取积分的方式
Unlock interview details and practice with AI
Curated Interview Questions from Top Companies
回复

使用道具 举报

🔗
joy9088 2014-7-26 05:20:29 | 只看该作者
全局:
可以用排序二叉树吗?
回复

使用道具 举报

🔗
一剑终情 2014-8-11 15:15:41 | 只看该作者
全局:
trie。。是我我也挂了
回复

使用道具 举报

🔗
brainrpi 2014-8-30 02:49:53 | 只看该作者
全局:
为什么不能直接用字典呢?
回复

使用道具 举报

🔗
B-1 2019-1-13 21:15:46 | 只看该作者
全局:
谢谢楼主分享!!!
回复

使用道具 举报

本楼:
全局:
感谢!!!!
回复

使用道具 举报

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

本版积分规则

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