Saturday, October 4, 2014

Pascal's Triangle

Problem

Given numRows, generate the first numRows of Pascal's triangle.

For example, given numRows = 5,
Return

Idea

从第3行开始,对于每一行,第一个是1,最后一个是1,其他的 a[i][j] = a[i-1][j-1]+a[i-1][j];

Solution


No comments:

Post a Comment