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

OpenAI 店面

 
👏 2
全局:

2023(10-12月) 工程类 博士 全职@openai - 猎头 - 技术电面  | 😃 Positive 😐 Average | Pass | 在职跳槽

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

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

x
就是地里面的原题 system design webhook+ codi
您好!
本帖隐藏的内容需要积分高于 188 才可浏览
您当前积分为 0。
使用VIP即刻解锁阅读权限或查看其他获取积分的方式
游客,您好!
本帖隐藏的内容需要积分高于 188 才可浏览
您当前积分为 0。
VIP即刻解锁阅读权限 或 查看其他获取积分的方式
Unlock interview details and practice with AI
Popular Interview Questions from Top Companies
优化cache,然后detect cycle

评分

参与人数 3大米 +5 收起 理由
duolaameng + 1 给你点个赞!
Ccqw12 + 1 给你点个赞!
匿名用户-8VFBD + 3 欢迎分享你知道的情况,会给更多大米奖励!

查看全部评分


上一篇:卖它VO面经
下一篇:求open ai onsite面经

本帖被以下淘专辑推荐:

  • · OpenAI|主题: 28, 订阅: 0
推荐
jeremy_sea 2024-2-29 08:13:13 | 只看该作者
全局:
按照我的理解写了一遍, 感觉用DFS写会简单很多,不知道为啥需要用BFS?
  1. from typing import Dict, Set, Optional

  2. cell_dict: Dict[str, 'Cell'] = {}


  3. class Cell:
  4.     def __init__(self, value=None, child1=None, child2=None):
  5.         self.value = value
  6.         if value:
  7.             assert child1 == child2 is None
  8.         if child1 or child2:
  9.             assert value is None
  10.         self.child1 = child1
  11.         self.child2 = child2
  12.         self.parents: Set['Cell'] = set()

  13.     def get_value(self) -> int:
  14.         if self.value:
  15.             return self.value
  16.         if self.child1 not in cell_dict or self.child2 not in cell_dict:
  17.             raise ValueError(f"fail to find children c1: {self.child1} c2: {self.child2}")
  18.         v = cell_dict[self.child1].get_value() + cell_dict[self.child2].get_value()
  19.         self.value = v
  20.         return v

  21.     def set_parent(self, parent: 'Cell', visited: Optional[Set] = None):
  22.         if not visited:
  23.             visited = set()
  24.         if parent in visited:
  25.             raise ValueError("Circular dependency detected")
  26.         visited.add(parent)
  27.         self.parents.add(parent)
  28.         if self.child1 and self.child2:
  29.             cell_dict[self.child1].set_parent(self, visited)
  30.             cell_dict[self.child2].set_parent(self, visited)

  31.     def invalidate(self):
  32.         self.value = None
  33.         for parent in self.parents:
  34.             parent.invalidate()


  35. class SpreadSheet:
  36.     def get_cell_value(self, key: str):
  37.         return cell_dict[key].get_value()

  38.     def set_cell(self, key: str, cell: Cell):
  39.         if key in cell_dict:
  40.             cell_dict[key].invalidate()
  41.         cell_dict[key] = cell
  42.         if cell.child1 and cell.child2:
  43.             cell_dict[cell.child1].set_parent(cell)
  44.             cell_dict[cell.child2].set_parent(cell)


  45. spreadsheet = SpreadSheet()
  46. spreadsheet.set_cell("A", Cell(6))
  47. spreadsheet.set_cell("B", Cell(7))
  48. spreadsheet.set_cell("C", Cell(value=None, child1="A", child2="B"))
  49. assert spreadsheet.get_cell_value("C") == 13
  50. spreadsheet.set_cell("A", Cell(5))
  51. assert spreadsheet.get_cell_value("C") == 12

  52. spreadsheet.set_cell("D", Cell(10))
  53. spreadsheet.set_cell("E", Cell(15))
  54. spreadsheet.set_cell("F", Cell(value=None, child1="D", child2="E"))
  55. assert spreadsheet.get_cell_value("F") == 25, "Incorrect value for cell F"
  56. spreadsheet.set_cell("D", Cell(20))
  57. assert spreadsheet.get_cell_value("F") == 35, "Incorrect value for cell F after updating value of D"
  58. # Test 2: Test circular dependency detection
  59. try:
  60.     spreadsheet.set_cell("D", Cell(value=None, child1="F", child2="E"))
  61. except ValueError as e:
  62.     assert str(e) == "Circular dependency detected"
  63. else:
  64.     raise AssertionError("Circular dependency not detected as expected")



复制代码
回复

使用道具 举报

推荐
brucewill1 2023-12-9 01:24:13 | 只看该作者
全局:
求问openAI的面试是怎么拿到的呀?
回复

使用道具 举报

🔗
 楼主| xxzjane 2023-12-8 14:38:35 | 只看该作者
全局:
本帖最后由 xxzjane 于 2023-12-7 22:43 编辑

顺便求VO面经,或者加群,欢迎私信
回复

使用道具 举报

🔗
 楼主| xxzjane 2023-12-9 06:20:37 | 只看该作者
全局:
brucewill1 发表于 2023-12-8 09:24
求问openAI的面试是怎么拿到的呀?

recruiter reach out的
回复

使用道具 举报

🔗
tutuabm 2023-12-9 08:39:45 | 只看该作者
全局:
请问lz coding的interface是什么
回复

使用道具 举报

🔗
 楼主| xxzjane 2023-12-9 08:47:30 | 只看该作者
全局:
tutuabm 发表于 2023-12-8 16:39
请问lz coding的interface是什么

int getCell(String key); setCell(String key, Cell cell)

评分

参与人数 2大米 +2 收起 理由
magicalcan + 1 赞一个
tutuabm + 1 很有用的信息!

查看全部评分

回复

使用道具 举报

🔗
tutuabm 2023-12-9 09:24:37 | 只看该作者
全局:
xxzjane 发表于 2023-12-8 16:47
int getCell(String key); setCell(String key, Cell cell)

感谢lz🙏
请问有接口用来更改cell的值和child吗
回复

使用道具 举报

🔗
 楼主| xxzjane 2023-12-9 14:50:06 | 只看该作者
全局:
tutuabm 发表于 2023-12-8 17:24
感谢lz🙏
请问有接口用来更改cell的值和child吗

没有,那个在test里面写好了的

评分

参与人数 1大米 +1 收起 理由
tutuabm + 1 很有用的信息!

查看全部评分

回复

使用道具 举报

地里匿名用户
🔗
匿名用户-VQ92Y  2023-12-11 17:39:07
webhook问了哪些问题呢?谢谢!
回复

使用道具 举报

地里匿名用户
🔗
匿名用户-VQ92Y  2023-12-11 17:42:12
您好!
本帖隐藏的内容需要积分高于 100 才可浏览
您当前积分为 0。
使用VIP即刻解锁阅读权限或查看其他获取积分的方式
游客,您好!
本帖隐藏的内容需要积分高于 100 才可浏览
您当前积分为 0。
VIP即刻解锁阅读权限 或 查看其他获取积分的方式
Unlock interview details and practice with AI
Popular Interview Questions from Top Companies
回复

使用道具 举报

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

本版积分规则

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