119.Pascals Triangle II
Last updated
Was this helpful?
Last updated
Was this helpful?
119.Pascals Triangle II
难度:Easy
给定一个非负索引 k,其中 k ≤ 33,返回杨辉三角的第 k 行。
在杨辉三角中,每个数是它左上方和右上方的数的和。
优化空间复杂度,需要牺牲一定的时间复杂度,可以使用递归实现。
执行用时 : 8 ms, 在Pascal's Triangle II的C++提交中击败了95.90% 的用户 内存消耗 : 9.2 MB, 在Pascal's Triangle II的C++提交中击败了5.14% 的用户