At Google Code Jam, Round 1A, I found this problem:
The bull eyes problem: Mary should paint a series of concentric circle, given a radius and an initial amount of paint. The problem is: given r and t (the radius and the amount of paint) how many circles of width 1cm Mary can pain?
I wrote my solution using TDD, but after a first thoughts, I coded a solution using a formula, see:
The commit history at:
At the beginning, I had an algorithm that depended on a function that calculates the amount of paint needed to paint a circle of radius r. But then, I replaced it by other algorithm, that directly returns the count of circles that Mary can pain, given an initial radius and paint quantity. All my tests continued to be in green.
As in other Google Code Jam problems, I didn’t write the console program using TDD. I put my focus on the right algorithm. In this case, it was enough to have a general formula that solves the problem.