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

Google电面 10/1

全局:

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

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

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

x
刚面完……珍爱生命,远离三姐…
1. challenging project
2. 给一个array, 找最小的正整数that is not in the array. 例如[1, 6, 3, 5] 返回2
3. 你在设计一个新的编程语言,这个语言要跟file system交互,给出它的interface
4. 用你
您好!
本帖隐藏的内容需要积分高于 188 才可浏览
您当前积分为 0。
使用VIP即刻解锁阅读权限或查看其他获取积分的方式
游客,您好!
本帖隐藏的内容需要积分高于 188 才可浏览
您当前积分为 0。
VIP即刻解锁阅读权限查看其他获取积分的方式
Unlock interview details and practice with AI
Curated Interview Questions from Top Companies
可是这时候只有几分钟了。


解法其实只要dfs然后处理好缩进就可以了…越靠近leave的文件的缩进越大。一个很简单的recursion即可。
还是太连清, 让我去先静一下……


评分

参与人数 5大米 +29 收起 理由
虾米酱 + 15 感谢分享!
menderr + 3 很有用的信息!
mjq04 + 3 很有用的信息!
hulahu + 3 感谢分享!
又见紫风铃 + 5 感谢分享!

查看全部评分


上一篇:Bloomberg 10.1新鲜电面
下一篇:Google简历被拒

本帖被以下淘专辑推荐:

全局:
第二道题不知道是不是这个意思。。。
  1. # Suppose we have the following API available
  2. # isFile(), isDirectory(), getFileOrDirectory()
  3. # input: the original position in the file system, e.g. ~/
  4. # output: None, just print the file system hierarchy under the input path
  5. class Solution:
  6.     def printHierarchyIterative(self, path):
  7.         if not path: return
  8.         stack = [(path, 1)]
  9.         while stack:
  10.             node, indentation = stack.pop()
  11.             print '-' * indentation + node
  12.             if node.isFile():
  13.                 continue
  14.             if node.isDirectory():
  15.                 for fileOrDir in node.getFileOrDirectory():
  16.                     stack.append((fireOrDic, indentation + 1))

  17.     def printHierarchyRecursive(self, path):
  18.         if not path: return
  19.         self.helper(path, 1)
  20.         return

  21.     def helper(self, node, indentation):
  22.         print '-' * indentation + node
  23.         if node.isDirectory():
  24.             for fileOrDir in node.getFileOrDirectory():
  25.                  self.helper(fileOrDir, indentation + 1)
  26.         return
复制代码
回复

使用道具 举报

推荐
tangvictor 2015-10-19 03:57:22 | 只看该作者
全局:
第四题我写了个python版, 如有bug请指正。

test case结果:
-0
--2
---21
--1
---13
---12
----122
---11
----112
----111
  1. class File:
  2.         def __init__(self, label):
  3.                 self.label = label
  4.                 self.children = []

  5.         def ls(self):
  6.                 return self.children

  7. def pathRead(f):
  8.         if f == None:
  9.                 return

  10.         stack = [(f, 1)]

  11.         while stack:
  12.                 cur, level = stack.pop()
  13.                 print ''.join(['-'] * level + [cur.label])

  14.                 for c in cur.ls():
  15.                         stack.append((c, level + 1))
复制代码
回复

使用道具 举报

全局:
额,求问什么叫做给出Interface啊
回复

使用道具 举报

🔗
syxgtsyxgt 2015-10-2 03:29:28 | 只看该作者
全局:
how do you know you fail. cheer up
回复

使用道具 举报

🔗
leixiang5 2015-10-2 03:37:15 | 只看该作者
全局:
谢谢楼主分享。
也许就onsite了。
回复

使用道具 举报

🔗
坐看云起 2015-10-2 03:39:31 | 只看该作者
全局:
求问,第二题的输入是什么?是输入一个树状的路径列表,还是自己获取当前路径下的目录?
回复

使用道具 举报

🔗
niubi 2015-10-2 03:46:48 | 只看该作者
全局:
interface是 file system下层用的,还是上层用的?
如果是file system本身用,能不能就open(), close(), read(), write(), mkdir() 这些?
回复

使用道具 举报

🔗
hulahu 2015-10-2 03:55:12 | 只看该作者
全局:
第二题, input是什么的啊。。
回复

使用道具 举报

🔗
TerrenceLi 2015-10-2 04:03:20 | 只看该作者
全局:
lz你说的interface要包括什么function啊,感觉一头雾水。
回复

使用道具 举报

🔗
 楼主| zhenghao58 2015-10-2 04:57:16 | 只看该作者
全局:
又见紫风铃 发表于 2015-10-2 03:20
额,求问什么叫做给出Interface啊

这个地方我没说清楚,她的意思是你现在需要写出一个完整的编程语言与系统的File System之间交互的一些API。
然后我就理解成类似java.io那样,就给出了open, close, read一系列。她说你这样的话不能打印出文件系统的hierarchy啊!然后我就知道得加入linux那些command,类似ls之类的。
回复

使用道具 举报

🔗
 楼主| zhenghao58 2015-10-2 04:58:54 | 只看该作者
全局:
TerrenceLi 发表于 2015-10-2 04:03
lz你说的interface要包括什么function啊,感觉一头雾水。

应该是一些常见的function,类似ls,move, rename之类的,反正我是这么写的… 不知道理解对不对。
三姐一般是等你走错方向了然后才告诉你,2货写错了吧~
回复

使用道具 举报

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

本版积分规则

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