⚡ Build the skills to land top-paying quant jobs. Offer ends in 17d 22h 18m 45s17 days 22 hours 18 minutes 45 seconds.
⚡ Build the skills to land top-paying quant jobs. Offer ends in 17d 22h 18m 45s17 days 22 hours 18 minutes 45 seconds.

Sign in to watch this lesson
Advanced - Combinatorics, Games and Puzzles · 4:40
In Nim, players take any number of tokens from one pile, and whoever takes the last token wins. After labelling winning and losing positions from the bottom up in a simple take-away game, we prove Bouton's theorem: the player to move loses exactly when the xor of the pile sizes is zero, and the winning move turns a pile x into x xor s. We finish with the misère version, where the last token loses, and two interview traps: the parity of the total and staircase Nim.