The Problem

How many possible ways can you make change for 2£ given the following English coins: 1p, 2p, 5p, 10p, 20p, 50p, 1£ (100p), 2£ (200p)?

Read More

Thinking Recursively

Thinking recursively doesn’t come naturally to me so I am fascinated by the fact that iterative functions can be expressed recursively. In this post I offer a step-by-step demonstration of how to turn the iterative Rock Paper Scissors solution into the recursive one.

Read More

The Problem

Write a function that generates every sequence of throws a single player could throw over a three-round game of rock-paper-scissors. For instance, one player might play ‘rock’ in every round so the outcome for this player would be [‘rock’, ‘rock’, ‘rock’]. Another player might choose a different play in each round so the outcome would be something like [‘paper’, ‘rock’, ‘scissors’].

Read More

The Problem

Recreate the functionality of the Underscore.js _.shuffle function.

Read More