难度:easy

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

For example, given numRows = 5,
Return

leetcode 118[easy]---Pascal's Triangle

思路:帕斯卡三角形。每层的每个元素就是上一行两个相邻元素相加(第一个和最后一个元素是1)。用两个for循环实现。

leetcode 118[easy]---Pascal's Triangle

相关文章:

  • 2021-10-08
  • 2021-08-20
  • 2021-08-13
猜你喜欢
  • 2021-11-15
  • 2021-04-28
  • 2021-12-28
  • 2022-01-25
  • 2021-09-28
  • 2021-11-01
  • 2021-09-10
相关资源
相似解决方案