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

Google电面跪经

全局:

2018(7-9月) 码农类General 硕士 全职@google - 内推 - 技术电面  | | Fail | 应届毕业生

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

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

x

上来问了下项目以及项目中你觉得最challenging的地方,然后开始做题。题目如下:
您好!
本帖隐藏的内容需要积分高于 150 才可浏览
您当前积分为 0。
使用VIP即刻解锁阅读权限或查看其他获取积分的方式
游客,您好!
本帖隐藏的内容需要积分高于 150 才可浏览
您当前积分为 0。
VIP即刻解锁阅读权限查看其他获取积分的方式
Unlock interview details and practice with AI
Curated Interview Questions from Top Companies


评分

参与人数 8大米 +31 收起 理由
章鱼章鱼 + 1 给你点个赞!
lzyprint + 3 欢迎来一亩三分地论坛!
wulaoshi250 + 5 给你点个赞!
lhailey + 1 赞一个
reliveinfire + 5 很有用的信息!

查看全部评分


上一篇:lyft 电面
下一篇:求databricks HR面经

本帖被以下淘专辑推荐:

推荐
foryousee 2018-11-8 02:44:31 | 只看该作者
全局:
tjuwdz95 发表于 2018-11-7 22:13
同求题号,查标题没有查到

肆迩鳍,字数

评分

参与人数 1大米 +5 收起 理由
bc2615 + 5 给你点个赞!

查看全部评分

回复

使用道具 举报

推荐
大木虫 2018-11-8 09:33:52 | 只看该作者
全局:
里口思儿其的代码
  1. /*
  2. // Definition for a QuadTree node.
  3. class Node {
  4. public:
  5.     bool val;
  6.     bool isLeaf;
  7.     Node* topLeft;
  8.     Node* topRight;
  9.     Node* bottomLeft;
  10.     Node* bottomRight;

  11.     Node() {}

  12.     Node(bool _val, bool _isLeaf, Node* _topLeft, Node* _topRight, Node* _bottomLeft, Node* _bottomRight) {
  13.         val = _val;
  14.         isLeaf = _isLeaf;
  15.         topLeft = _topLeft;
  16.         topRight = _topRight;
  17.         bottomLeft = _bottomLeft;
  18.         bottomRight = _bottomRight;
  19.     }
  20. };
  21. */
  22. class Solution {
  23. public:
  24.     Node* construct(vector<vector<int>>& grid) {
  25.         return ConstructRec(grid, {0, 0}, {grid.size()-1, grid[0].size()-1} );
  26.     }
  27.    
  28.     Node* ConstructRec(const vector<vector<int> > & grid, const pair<int, int>& topLeft, const pair<int, int>& bottomRight){
  29.         Node* node = new Node();
  30.         node->topLeft = NULL;
  31.         node->topRight = NULL;
  32.         node->bottomLeft = NULL;
  33.         node->bottomRight = NULL;
  34.         node->val = grid[topLeft.first][topLeft.second];
  35.         if(!IsUniversal(grid, topLeft, bottomRight)){
  36.             node->isLeaf = false;
  37.             pair<int, int> center = {(topLeft.first + bottomRight.first) / 2, (topLeft.second + bottomRight.second) / 2};
  38.             node->topLeft = ConstructRec(grid, topLeft, center);
  39.             node->topRight = ConstructRec(grid, {topLeft.first, center.second+1}, {center.first, bottomRight.second});
  40.             node->bottomLeft = ConstructRec(grid, {center.first+1, topLeft.second}, {bottomRight.first, center.second});
  41.             node->bottomRight = ConstructRec(grid, {center.first+1, center.second+1}, bottomRight);
  42.         }else node->isLeaf = true;        
  43.         
  44.         return node;
  45.         
  46.     }
  47.    
  48.     bool IsUniversal(const vector<vector<int> > & grid,
  49.                      const pair<int, int>& topLeft, const pair<int, int>& bottomRight){
  50.         int val = grid[topLeft.first][topLeft.second];
  51.         for(int i = topLeft.first; i <= bottomRight.first; ++i){
  52.             for(int j = topLeft.second; j <= bottomRight.second; ++j){
  53.                 if(val != grid[i][j]){
  54.                     return false;
  55.                 }
  56.             }
  57.         }
  58.         return true;
  59.     }
  60. };
复制代码
回复

使用道具 举报

推荐
 楼主| destinywhc 2018-11-7 12:39:24 | 只看该作者
全局:
题目意思大概是要利用第一个method来判断坐标区域内是否为全黑全白或者都有,三种情况会分别返回1,-1,0。第二个method是在坐标区域内画图,但是画出来的图只有黑色。
回复

使用道具 举报

全局:
这个题要点在什么地方?
回复

使用道具 举报

🔗
Nooneknows 2018-11-7 10:32:55 | 只看该作者
全局:
没有get到意思,楼主能否解释一下呢?
回复

使用道具 举报

全局:
意思是把读取之后存起来然后再画出来吗?还是什么别的条件没有个给?
回复

使用道具 举报

全局:
这个应该是leetcode quater square那道题。永远四分。全白就是白,全黑就是黑,黑白就四分然后recursion。
回复

使用道具 举报

🔗
tangbb 2018-11-7 13:41:57 | 只看该作者
全局:
感谢楼主分享
回复

使用道具 举报

🔗
ewyy 2018-11-7 18:40:56 | 只看该作者
全局:
foryousee 发表于 2018-11-7 12:50
这个应该是leetcode quater square那道题。永远四分。全白就是白,全黑就是黑,黑白就四分然后recursion。

请问有蠡口题号吗
回复

使用道具 举报

🔗
tjuwdz95 2018-11-7 22:13:27 | 只看该作者
全局:
foryousee 发表于 2018-11-6 20:50
这个应该是leetcode quater square那道题。永远四分。全白就是白,全黑就是黑,黑白就四分然后recursion。

同求题号,查标题没有查到
回复

使用道具 举报

🔗
bc2615 2018-11-8 00:03:31 | 只看该作者
全局:
foryousee 发表于 2018-11-7 00:50
这个应该是leetcode quater square那道题。永远四分。全白就是白,全黑就是黑,黑白就四分然后recursion。

请问具体题目叫什么?

评分

参与人数 1大米 +5 收起 理由
UC小王子 + 5 给你点个赞!

查看全部评分

回复

使用道具 举报

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

本版积分规则

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