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

开放爱电面

🔗
匿名用户-GEQVT  昨天 07:30 |倒序浏览
💯 2

2026(10-12月) 码农类General 博士 全职@openai - 猎头 - 技术电面  | 😐 Neutral 😣 Hard | Fail | 在职跳槽
两轮,一轮design一轮coding

Design:

PC Game Store and Launcher
Design the backend architecture for a Steam-like PC game store and desktop launcher.
You can think of the system as a combination of:
  • An e-commerce store for browsing and purchasing games.
  • A digital entitlement system that tracks which games each user owns.
  • A large-file
    您好!
    本帖隐藏的内容需要积分高于 188 才可浏览
    您当前积分为 0。
    使用VIP即刻解锁阅读权限或查看其他获取积分的方式
    游客,您好!
    本帖隐藏的内容需要积分高于 188 才可浏览
    您当前积分为 0。
    VIP即刻解锁阅读权限 或 查看其他获取积分的方式
    Unlock interview details and practice with AI
    Curated Interview Questions from Top Companies
    ign和high level design全部cover,再开始deep dive。

    Coding:

    Elevator scheduling

    Part 1.



    Part 2.

    还有Part 3,但我在Part 2就没debug完,就没看到part 3了。有代码模板:

    models.py:
    1. from dataclasses import dataclass, field
    2. # NB: A floor/level is 0-indexed for coding simplicity even though IRL we usually
    3. # refer to the first floor as floor 1. Keep that in mind for debugging / printing.
    4. @dataclass
    5. class Person:
    6.     id: str
    7.     """Just an identifier of an individual person."""
    8.     src: int
    9.     """The floor the person started on when they called the elevator."""
    10.     dst: int
    11.     """The floor the person is trying to get to."""
    12.     def __str__(self) -> str:
    13.         return f"{self.id}({self.src}->{self.dst})"
    14. @dataclass
    15. class Floor:
    16.     level: int
    17.     """Which level does this floor represent?"""
    18.     people: list[Person] = field(default_factory=list)
    19.     """The people on this floor currently waiting for an elevator."""
    20. @dataclass
    21. class Elevator:
    22.     """You can add/remove/modify fields as you'd like here."""
    23.     id: str
    24.     """Just an identifier of an individual elevator."""
    25.     curr_floor: Floor
    26.     """The elevator's current floor."""
    27.     passengers: list[Person] = field(default_factory=list)
    28.     """The people in this elevator right now."""
    29.     direction: int = 1
    30.     """
    31.     The elevator's direction.
    32.     1 is up, -1 is down, but you can change this as you'd like or use some other
    33.     convention.
    34.     """
    35.     def __str__(self) -> str:
    36.         passengers_str = ",".join([str(person) for person in self.passengers])
    37.         match self.direction:
    38.             case 0:
    39.                 dir_str = "↔"
    40.             case 1:
    41.                 dir_str = "↑"
    42.             case -1:
    43.                 dir_str = "↓"
    44.             case _:
    45.                 raise Exception(f"Unknown direction {self.direction}")
    46.         return f"{dir_str}[{passengers_str}]"
    47. @dataclass
    48. class Building:
    49.     elevators: list[Elevator]
    50.     @property
    51.     def elevator(self) -> Elevator:
    52.         """
    53.         For parts 1-3, there is only 1 elevator, so use this accessor for convenience.
    54.         """
    55.         return self.elevators[0]
    56.     floors: list[Floor]
    57.     @property
    58.     def num_floors(self) -> int:
    59.         return len(self.floors)
    60. @dataclass
    61. class _World:
    62.     building: Building
    63.     tick_to_calls: dict[int, list[Person]]
    64.     tick: int = 0
    复制代码
    loop.py
    1. from typing import Callable
    2. from animation import animate
    3. from models import Building, _World
    4. def _is_simulation_over(world: _World) -> bool:
    5.     if world.tick <= max(world.tick_to_calls.keys()):
    6.         return False
    7.     for elevator in world.building.elevators:
    8.         if len(elevator.passengers) > 0:
    9.             return False
    10.     for floor in world.building.floors:
    11.         if len(floor.people) > 0:
    12.             return False
    13.     return True
    14. def run_simulation(
    15.     world: _World,
    16.     do_tick_fn: Callable[[Building], None],
    17.     debug: bool = False,
    18. ) -> _World:
    19.     """
    20.     Runs the elevator simulation until complete.
    21.     """
    22.     while True:
    23.         for person_calling in world.tick_to_calls[world.tick]:
    24.             world.building.floors[person_calling.src].people.append(person_calling)
    25.         if debug:
    26.             animate(world)
    27.         do_tick_fn(world.building)
    28.         world.tick += 1
    29.         print("current level:", world.building.elevators[0].curr_floor.level)
    30.         if _is_simulation_over(world):
    31.             break
    32.     if debug:
    33.         animate(world)
    34.     return world
    复制代码
    part1.py, part2.py
    1. from models import Building
    2. def do_tick(building: Building) -> None:
    3.   pass
    复制代码

本帖子中包含更多资源

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

x

评分

参与人数 8大米 +20 收起 理由
匿名用户-T2CD7 + 2 谢谢分享!
leanlee + 1 祝楼主一切顺利!
rabbit2025 + 1 给你点个赞!
shshrosh + 1 谢谢分享!
开心的猪 + 1 给你点个赞!

查看全部评分


上一篇:applied intutition第二轮店面
下一篇:Google L6 挂经
地里匿名用户
🔗
匿名用户-VLMIW  昨天 08:41
感谢分享,请问是这周面的吗?
回复

使用道具 举报

全局:
Thanks for sharing — for the design round, did it stay mostly high-level or go into a deep dive, and for the elevator coding, could you run the code on a shared screen while you debugged Part 2?
回复

使用道具 举报

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

使用道具 举报

🔗
I0l 昨天 10:55 | 只看该作者
全局:
电梯调度这题 part2 没 debug 完确实亏。想问下 design 那轮的 entitlement 系统,面试官有追问并发购买同一游戏的幂等问题吗?顺便 mark 蹲一个后续。
回复

使用道具 举报

全局:
I0l 发表于 2026-10-30 19:55:51
电梯调度这题 part2 没 debug 完确实亏。想问下 design 那轮的 entitlement 系统,面试官有追问并发购买同一游戏的幂等问题吗?顺便
有问到失败重试的幂等
回复

使用道具 举报

地里匿名用户
🔗
匿名用户-GEQVT  昨天 12:49
匿名用户 发表于 2026-10-30 17:41:44
感谢分享,请问是这周面的吗?
是的
回复

使用道具 举报

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

使用道具 举报

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

使用道具 举报

地里匿名用户
🔗
匿名用户-FKPXZ  昨天 13:46 来自APP
哇感谢分享

这俩题都没见过 感谢dp!
回复

使用道具 举报

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

本版积分规则

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