This week’s Scala Kata was suggested to me by Tim Dalton. For a given number, build Pascal’s Triangle as a List of Lists starting from the top down.

Here’s some examples to illustrate:
Given n = 1, then the result should be List(List(1))
Given n = 2, then the result should be List(List(1), List(1,1))
Given n = 4, then the result should be List(List(1),List(1,1), List(1,2,1), List(1,3,3,1))
And so on. Can you generate a triangle to the 14th row as in the above graphic? How about the 30th row?


And yes, I realize I did not post this till Sunday. It’s been a busy weekend.
Here’s my solution: http://gist.github.com/434622
Incidently, there’s an error in the graphic. The last row is {1,13,78,186,…,186,78,13,1} but it should be {1,13,78,286,…,286,78,13,1}