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

google foobar题目

全局:

2016(10-12月) 码农类General 硕士 全职@google - Other - 在线笔试  | | Other | 应届毕业生

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

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

x
同学在google foobar上的一道题, 提交时候一直是400 bad request,估计是超时了,分享给我题目和他的解法,求优化
Prepare the Bunnies' Escape
===========================

You're awfully close to destroying the LAMBCHOPdoomsday device and freeing Commander Lambda's bunny prisoners, but oncethey're free of the prison blocks, the bunnies are going to need to escapeLambda's space station via the escape pods as quickly as possible.Unfortunately, the halls of the space station are a maze of corridors and deadends that will be a deathtrap for the escaping bunnies. Fortunately, CommanderLambda has put you in charge of a remodeling project that will give you theopportunity to make things a little easier for the bunnies. Unfortunately(again), you can't just remove all obstacles between the bunnies and the escapepods - at most you can remove one wall per escape pod path, both to maintainstructural integrity of the station and to avoid arousing Commander Lambda'ssuspicions.

You have maps of parts of the space station, each starting at a prison exit andending at the door to an escape pod. The map is represented as a matrix of 0sand 1s, where
您好!
本帖隐藏的内容需要积分高于 188 才可浏览
您当前积分为 0。
使用VIP即刻解锁阅读权限或查看其他获取积分的方式
游客,您好!
本帖隐藏的内容需要积分高于 188 才可浏览
您当前积分为 0。
VIP即刻解锁阅读权限查看其他获取积分的方式
Unlock interview details and practice with AI
Curated Interview Questions from Top Companies
               min = Math.min(dfs(nx, ny, allowRemove, visited, maze, len + 1), min);
           }else if(allowRemove){
               min = Math.min(dfs(nx, ny, false, visited, maze, len + 1), min);
           }
           if(min == maze.length + maze[0].length - 1){
               break;
           }
        }
        visited[x][y] = false;
        return min;
    }


上一篇:想问下去Grace Hopper的妹子如何拿到面试?
下一篇:Yelp 15min OA
🔗
WhatsFLAG 2016-9-27 04:02:42 | 只看该作者
全局:
第一次听说Foobar,Google了一下感觉赞爆了!
回复

使用道具 举报

🔗
kolanery 2016-10-1 08:19:45 | 只看该作者
全局:
400 bad request好像是foobar的bug...
回复

使用道具 举报

🔗
ja0b 2017-6-17 11:49:22 | 只看该作者
全局:
所以楼主最后做出来了吗?我也在做这题,想请教一下谢谢!
回复

使用道具 举报

🔗
chengguan914 2017-9-24 06:42:24 | 只看该作者
全局:
ja0b 发表于 2017-6-17 11:49
所以楼主最后做出来了吗?我也在做这题,想请教一下谢谢!

请问朋友,你做出来了吗?我还在研究这道题。
回复

使用道具 举报

🔗
qlwfby 2017-10-12 04:21:30 | 只看该作者
全局:
我也写了这题,用两边BFS,第一遍记录最短,第二遍的时候从终点出发,遇到墙就试图拆
回复

使用道具 举报

🔗
uathena 2018-11-8 04:32:47 | 只看该作者
全局:
qlwfby 发表于 2017-10-12 04:21
我也写了这题,用两边BFS,第一遍记录最短,第二遍的时候从终点出发,遇到墙就试图拆

请问您能详细说说 从终点出发遇墙则拆的原理吗?
回复

使用道具 举报

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

本版积分规则

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