LeetCode118.  Pascal's Triangle

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

For example, given numRows = 5,
Return


[ [1], [1,1], [1,2,1], [1,3,3,1], [1,4,6,4,1] ]


很简单,递推就行了,首先摆出特殊的第一个数组【1】,以后的每一层,都是首先一个1,然后是上一个数组t0所有的t0[i]和t0[i+1]的和,最后再添个1.

Day11 Pascal's Triangle

相关文章:

  • 2021-08-20
  • 2021-09-01
  • 2021-07-18
  • 2021-08-02
  • 2021-07-16
  • 2021-05-24
  • 2022-02-28
  • 2021-05-22
猜你喜欢
  • 2021-04-05
  • 2022-12-23
  • 2021-10-14
相关资源
相似解决方案