Coin Piles
Table of Contents
A Practical Guide To Quantitative Finance Interviews 收录了一些量化面试中的经典题目. 本文介绍的是来自第二章的「Coin Piles」.
Coin Piles #
Problem #
Suppose that you are blind-folded in a room and are told that there are 1000 coins on the floor. 980 of the coins have tails up and the other 20 coins have heads up. Can you separate the coins into two piles so to guarantee both piles have equal number of heads? Assume that you cannot tell a coin’s side by touching it, but you are allowed to turn over any number of coins.
Solution #
把硬币分成 $20$ 枚和 $980$ 枚的两堆, 然后把 $20$ 枚的那一堆翻面即可. 假设 $20$ 枚这一堆的硬币中有 $x$ 枚正面朝上的硬币, 那么反面后有 $20 - x$ 枚正面朝上的硬币, 而 $980$ 枚那一堆硬币中也恰好有 $20 - x$ 枚正面朝上的硬币. 这样两堆硬币中正面朝上的硬币数量就相等了.