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

google 2018四月onsite面筋

   
🔗
白居易 2018-5-3 06:16:14 | 只看该作者
全局:
北极猪一只 发表于 2018-4-30 02:44
写完了还没发,写了四千字累死我了

厉害了 坐等 先给你加米
回复

使用道具 举报

🔗
kaseyhebe 2018-5-3 21:52:18 | 只看该作者
本楼:
全局:
谢谢楼主
回复

使用道具 举报

🔗
hychin 2018-5-5 06:39:28 | 只看该作者
全局:
楼主决定去狗家了么,是的话可以加下google full time 2018的群

本帖子中包含更多资源

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

x
回复

使用道具 举报

🔗
waxc 2018-5-5 10:08:01 | 只看该作者
全局:
想问下楼主,也是电话通知的吗?还是邮件通知的?
回复

使用道具 举报

🔗
hychin 2018-5-6 04:04:58 | 只看该作者
全局:
楼主从了狗家了么 是的话加我微信 我把你加进谷歌2018fulltime群  28222522
回复

使用道具 举报

🔗
walkingdead 2018-5-6 11:06:38 | 只看该作者
全局:
第一题可以用bit manipulation比较方便吧? 类似用hashmap了,如果target里面不能有重复的话。
第三题我好像没太理解题意,如果是每一秒内random地返回n个true,那么每一秒总共有多少个query是已知的吗?假如说每秒总共x个,那x是远大于n吗?
回复

使用道具 举报

🔗
hychin 2018-5-7 10:59:16 | 只看该作者
全局:
楼主接了吗。可以去这里加下谷歌的fulltime群
http://www.1point3acres.com/bbs/thread-405535-1-1.html
回复

使用道具 举报

全局:
题4。只是实现了主要算法。
  1.     static class TrieNode {
  2.         public TrieNode[] nodes = new TrieNode[26];
  3.         public String word;
  4.     }

  5.     public static List<String> findWordInStream(char[] chs, String[] words) {
  6.         TrieNode root = new TrieNode();
  7.         for (String word : words) {
  8.             TrieNode curr = root;
  9.             for (char ch : word.toCharArray()) {
  10.                 if (curr.nodes[ch - 'a'] == null) {
  11.                     curr.nodes[ch - 'a'] = new TrieNode();
  12.                 }
  13.                 curr = curr.nodes[ch - 'a'];
  14.             }
  15.             curr.word = word;
  16.         }
  17.         List<TrieNode> nodeList = new ArrayList<>();
  18.         Set<String> ansSet = new HashSet<>();
  19.         for (char ch : chs) {
  20.             if (root.nodes[ch - 'a'] != null) {
  21.                 TrieNode curr = root;
  22.                 nodeList.add(curr);
  23.             }
  24.             List<TrieNode> tmpNodeList = new ArrayList<>();
  25.             for (TrieNode node : nodeList) {
  26.                 if (node.nodes[ch - 'a'] != null) {
  27.                     node = node.nodes[ch - 'a'];
  28.                     if (node.word != null) {
  29.                         ansSet.add(node.word);
  30.                     }
  31.                     tmpNodeList.add(node);
  32.                 }
  33.             }
  34.             nodeList = tmpNodeList;
  35.         }
  36.         List<String> ans = new ArrayList<>();
  37.         ansSet.forEach(p -> ans.add(p));
  38.         return ans;
  39.     }
复制代码
回复

使用道具 举报

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

本版积分规则

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