📣 黑五价提前开抢|VIP一年通行证5折,蓝莓、Offer多多同步特惠
楼主: 匿名
跳转到指定楼层
上一主题 下一主题
收起左侧

菜鸡 google onsite 过经

 
全局:
楼主只有四轮面试咩?
回复

使用道具 举报

🔗
Jianping 2018-10-4 00:02:21 | 只看该作者
全局:
在湾区还是西雅图面的
回复

使用道具 举报

🔗
sstcurry 2018-10-7 13:06:44 | 只看该作者
全局:
"给个 tree 找多的一条边" -> 这题是找tree中最长的一条path吗?
回复

使用道具 举报

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

使用道具 举报

🔗
lllllgggggjksjk 2018-11-20 09:04:55 | 只看该作者
全局:
恭喜楼主呢!!我昨天刚被通知说感恩节之后送HC,特地前来沾沾楼主的喜气!希望自己也能过HC!!!念念不忘,必有回响!!希望能去google呜呜呜!!!
回复

使用道具 举报

🔗
salamanderrex1 2018-12-29 17:13:18 | 只看该作者
全局:
1.
不知道怎么获取最左下的点。有点感觉像graham第一步。但是不会。mark下

2. follow up

  1. # k additional people
  2. import heapq
  3. def maxCloestPeopleForK(nums, k):
  4.     # lenth of 0 and isEdge?
  5.     min_heap = []
  6.     for val, group in itertools.groupby(nums):
  7.         if val == 0 :
  8.             g = list(group)
  9.             heapq.heappush(min_heap, ((-len(g), False)))

  10.     if nums[0] == 0:
  11.         heapq.heappush(min_heap, (-nums.index(1), True))
  12.     if nums[-1] == 0:
  13.         heapq.heappush(min_heap, (-nums[::-1].index(1), True))

  14.     for _ in range(k):
  15.         l, isEdge = heapq.heappop(min_heap)
  16.         l = -l
  17.         if isEdge:
  18.             print l
  19.             heapq.heappush((-(l-1), False))
  20.         else:
  21.             print (l + 1) /2
  22.             heapq.heappush(min_heap, (-(l-1)/2, False))
  23.             heapq.heappush(min_heap, (-l/2, False))



  24. print 'do k people'
  25. maxCloestPeopleForK([1,0,0,0,0,0,0,1,0,0,0],3)
复制代码



3. 摸牌

  1. from itertools import combinations
  2. def possible(cards):
  3.     result = []
  4.     for k in range(1,4):
  5.         for c in combinations(cards, k):
  6.             result.append(set(c))
  7.     return result

  8. def stoneGame(cards):
  9.     N = len(cards)
  10.     idxs = set(range(N))

  11.     seen = {}
  12.     def dp(handA, handB, Aturn):
  13.         if (frozenset(handA), frozenset(handB), Aturn) in seen:
  14.             print 'hit'
  15.             return seen[(frozenset(handA), frozenset(handB), Aturn) ]

  16.         if len(handA) + len(handB) == N: return handA, handB

  17.         cards_this_turn = possible(idxs - handA - handB)
  18.         if Aturn:
  19.             result = sorted([dp(handA|taken, handB, False) for taken in cards_this_turn], key = lambda x: -sum(x[0]))[0]
  20.             seen[frozenset(handA), frozenset(handB), Aturn] = result
  21.             return result
  22.         else:
  23.             result = sorted([dp(handA, handB|taken, True) for taken in cards_this_turn], key = lambda x: sum(x[0]))[0]
  24.             seen[frozenset(handA), frozenset(handB), Aturn] = result
  25.             return result

  26.     result = dp(set(), set(), True)
  27.     print(result)


  28. stoneGame([10,10,10,11])
  29. stoneGame([-10000,10,10])
  30. stoneGame([-10000,-10,10])
复制代码
回复

使用道具 举报

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

使用道具 举报

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

使用道具 举报

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

本版积分规则

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