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

Zoox 店面,新题

🔗
匿名用户-HOUSP  2023-12-12 16:01:25 |倒序浏览

2023(7-9月) 码农类General 硕士 全职@zoox - 内推 - 技术电面  | 😃 Positive 😣 Hard | Pass | 在职跳槽

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

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

x
Zoox今年的新题, roller coaster
Roller Coaster Simulator
You’re working on a new video game in which players build roller coasters for a simulated theme park. You need to create a system to produce an overall score for each submitted coaster so they may be ranked in an online leaderboard.

Input
You can assume the input will be provided as a list of strings describing the roller coaster type followed by the stats for each coaster. All stats are numbers except LiftType, which is a string that can take one of the following values: “Cable”, “Chain”, “Launched”. The input format is as follows:
RollerCoasterType MaxSpeed BumpsPerSecond LiftType
Per-type Coaster Scoring Functions
For this problem we will consider only the three coaster types described below, but your solution should be able to scale to 10-20 different roller coaster types and be able to process many roller coasters efficiently. The score function is broken down into two parts, the “Comfort” score, and the “Overall” score, defined below. Your tool should print out “Overall” score, for use in the leaderboard rankings.
Comfort
The comfort of a roller coaster can be an arbitrary function of MaxSpeed, BumpsPerSecond, and LiftType. Unless otherwise stated, the comfort score is computed as follows:
Comfort: min(1.0, 1.0 / BumpsPerSecond, 1.0 / MaxSpeed)
Overall
The overall score of a roller coaster is computed as follows, where ScaleFactor is a constant scaling factor that differs by roller coaster type:
Overall: ScaleFactor * Comfort * MaxSpeed
Roller Coaster Types
The roller coaster types you will need to consider are as follows:
1. Wooden
    - ScaleFactor: 1.0
2. Steel
    - ScaleFactor: 2.0
    - Comfort: min(1.0, 1.0 / BumpsPerSecond, 5 / MaxSpeed)
3. Suspended
    - ScaleFactor: 0.5
    - A LiftType of "Cable" adds an additional 0.5 to Comfort
Example
Input
Wooden 4 1.0 Chain
Steel 20 2.0 Cable
Suspended 2 1.5 Cable
Suspended 2 1.5 Chain
Output
Overall: 1.0
Overall: 10.0
Overall: 1.0
Overall: 0.5
Explanation of Output
Comfort = min(1.0, 1.0/1.0, 1/4); Overall = 4.0*0.25=1.0
Comfort = min(1.0, 1.0/2.0, 5/20); Overall = 2*20*0.25=10.0
Comfort = min(1.0, 1.0/1.5, 1/2) + 0.5; Overall = 0.5*2.0*1.0=1.0
Comfort = min(1.0, 1.0/1.5, 1/2); Overall = 0.5*2.0*0.5=0.5

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


求大米看面经~

评分

参与人数 6大米 +20 收起 理由
William_gao + 1 欢迎分享你知道的情况,会给更多积分奖励!
流萤ting99 + 1 给你点个赞!
微信用户_0397f9c + 1 给你点个赞!
fuhao8235 + 1 很有用的信息!
匿名用户-8K11D + 15 欢迎分享你知道的情况,会给更多大米奖励!

查看全部评分


上一篇:Tesla take home challenge
下一篇:Circle OA
🔗
stonephoenix 2024-4-14 00:33:58 | 只看该作者
全局:
感觉只用写一个 class, 没有继承什么的,就可以啊。楼主怎么写的,过了吗?
回复

使用道具 举报

🔗
orange475 2024-4-14 13:58:05 | 只看该作者
全局:
楼主zoox 面试用的是coderpad project 么? 还是所有class 写在一个文件里就可以了?
回复

使用道具 举报

地里匿名用户
🔗
匿名用户-WA6XT  2024-5-3 08:04:46
这是店面的题吗?光看题就得10几分钟啊
回复

使用道具 举报

地里匿名用户
🔗
匿名用户-WA6XT  2024-5-3 08:08:56
stonephoenix 发表于 2024-4-13 11:33
感觉只用写一个 class, 没有继承什么的,就可以啊。楼主怎么写的,过了吗?

对啊,就是计算2个分数而已,计算公式略有不同,都不值得继承 啊
回复

使用道具 举报

全局:
匿名用户 发表于 2024-05-02 17:08:56
对啊,就是计算2个分数而已,计算公式略有不同,都不值得继承 啊
面试官需要考虑可延展性,过山车的类别可以无限增加
回复

使用道具 举报

地里匿名用户
🔗
匿名用户-WA6XT  2024-5-3 11:01:58
蒙古客 发表于 2024-5-2 20:04
面试官需要考虑可延展性,过山车的类别可以无限增加

所以是每个类型的过山车继承过山车然后override?还是说写一个factory产生不同的过山车
回复

使用道具 举报

全局:
匿名用户 发表于 2024-05-02 20:01:58
所以是每个类型的过山车继承过山车然后override?还是说写一个factory产生不同的过山车
我用的factrory面试过了
回复

使用道具 举报

地里匿名用户
🔗
匿名用户-WA6XT  2024-5-3 11:19:37
蒙古客 发表于 2024-5-2 22:04
我用的factrory面试过了

厉害厉害,可以分享一下吗?
回复

使用道具 举报

🔗
blessme 2024-6-2 13:26:27 | 只看该作者
全局:
面试官有问对其他设计模式的了解吗
回复

使用道具 举报

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

本版积分规则

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