一亩三分地论坛

 找回密码
 获取更多干货,去instant注册!

扫码关注一亩三分地公众号
查看: 659|回复: 0
收起左侧

Square面经

[复制链接] |试试Instant~ |关注本帖
haifengc 发表于 2015-10-21 10:29:49 | 显示全部楼层 |阅读模式

2015(10-12月) 码农类 博士 全职@Square - 网上海投 - 技术电面 |Failfresh grad应届毕业生

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

您需要 登录 才可以下载或查看,没有帐号?获取更多干货,去instant注册!

x
Let's implement the Monty Hall problem from Let's Make a Deal, with an arbitrary number of doors.  In this game show, there are n doors – we'll take this as a parameter.  Behind one of them is a fabulous prize (a car), and behind the others are worthless items (goats).  To start, the player will pick one of the doors – this is our second parameter. This door is not opened. Then the host will reveal a goat behind another door, continuing until there are only two doors still closed: one the contestant first chose and one other.  The host only reveals goats, never reveals the door the player has chosen, and stops when there are only two doors left (the one the player has chosen and one other).  Then the host offers the player a choice: either keep their current door or switch to the other closed door – this choice is our last parameter.  Then the host reveals what's behind the chosen door, and the player either wins a fabulous prize or a goat.  We'll start with simulating a single game, taking an arbitrary number of doors.

评分

2

查看全部评分

本版积分规则

请点这里访问我们的新网站:一亩三分地Instant.

Instant搜索更强大,不扣积分,内容组织的更好更整洁!目前仍在beta版本,努力完善中!反馈请点这里

关闭

一亩三分地推荐上一条 /5 下一条

手机版|小黑屋|一亩三分地论坛声明 ( 沪ICP备11015994号 )

custom counter

GMT+8, 2016-12-7 05:58

Powered by Discuz! X3

© 2001-2013 Comsenz Inc. Design By HUXTeam

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