注册一亩三分地论坛,查看更多干货!
您需要 登录 才可以下载或查看附件。没有帐号?注册账号 
x
面经|Firmware Overheat Controller 模拟题(90 minutes 一道 coding)
背景/形式:
一道 coding,限时 90 minutes,语言可选 C++ / Java / Python。题目不算算法难题,主要是状态模拟 + 边界 + 输出格式。要求实现一个 pure function,模拟多核处理器的固件温控器。
---
题目
> The assessment had one coding question, with C++, Java, and Python available as language options.
>
> Simulate a firmware controller that prevents a multicore processor from overheating. Each core has a configured workload, all cores share passive cooling, and each running core can receive a dedicated active-cooling channel.
>
> Implement a pure function that processes the controller operations in order:
>
>- > simulateOverheatController(
- > passiveCapacity,
- > activeCapacityPerCore,
- > coreIds,
- > operations
- > ) -> list of Tick results
- >
复制代码 >
> Each operation is one of:
>
>- > ["set", timestamp, coreId, loadWatts]
- > ["tick", timestamp]
- >
复制代码 >
&g="monospace">tick。
3. 只输出状态发生变化的 core,不是输出所有 core。
4. 每个 tick 内部按 coreId 排序。
5. passive cooling 只由 running cores 共享;没有 running core 时不要除以 0。
6. 用乘法比较避免浮点精度问题。
7. pure function:不要修改传入的 operations 或 coreIds,新建字典和结果数组。
8. 同一 core 多次 set 时,后一次覆盖前一次。
9. 状态名以原题为准,例如可能是 OK / THROTTLED / OFF,也可能是 RUNNING / THROTTLED / IDLE。 |