package com.llh.demo; /** * 杨辉三角 * * @author llh * */ public class Test { /* * 杨辉三角 */ public static void main(String[] args) { int[] a = new int[11]; int num = 1; // for (int i = 1; i <= 10; i++) { for (int j = 1; j <= i; j++) { int c = a[j]; a[j]
题目 给定一个非负索引 k,其中 k ≤ 33,返回杨辉三角的第 k 行. 在杨辉三角中,每个数是它左上方和右上方的数的和. 示例: 输入: 3 输出: [1,3,3,1] 来源:力扣(LeetCode) 链接:https://leetcode-cn.com/problems/pascals-triangle-ii 著作权归领扣网络所有.商业转载请联系官方授权,非商业转载请注明出处. 解题 模板: /** * Note: The returned array must be malloced,