Test Driven Development for the problem https://code.google.com/codejam/contest/189252/dashboard#s=p0