Skip to main content
  1. Posts/

Calendar Cubes

·1 min·
Table of Contents

A Practical Guide To Quantitative Finance Interviews 收录了一些量化面试中的经典题目. 本文介绍的是来自第二章的「Calendar Cubes」.

Calendar Cubes #

Problem #

You just had two dice custom-made. Instead of numbers 1 - 6, you place single-digit numbers on the faces of each dice so that every morning you can arrange the dice in a way as to make the two front faces show the current day of the month. You must use both dice (in other words, days 1 - 9 must be shown as 01 - 09), but you can switch the order of the dice if you want. What numbers do you have to put on the six faces of each of the two dice to achieve that?

Solution #

考虑 11 和 22 可知, 两个骰子都应该有 1 和 2 . 因为有 01, 02, …, 09 . 如果只有第一个骰子有 0 , 那么第二个骰子不能够表示出 01, 02, …, 09 的所有情况, 因此两个骰子都需要有 0 , 并且一个拥有 3, 4, 5, 一个拥有 6, 7, 8. 注意到印有 6 的骰子可以当作印有 9 的骰子使用, 我们可以验证 (0, 1, 2, 3, 4, 5) 和 (0, 1, 2, 6, 7, 8) 的组合能够表示所有的合法日期.