1. Job Roadmap
  2. Home
  3. Problem Set
  4. codenotelist
  5. Forum
  6. course
  7. Shore Share Sessions
  8. Record
  1. Login
  2. Sign Up
  3. Language
    1. English
    2. 한국어
    3. 简体中文
    4. 正體中文
    ZhContent TextSol AI分析

题解

题面描述

给定一个非负整数 numRowsnumRowsnumRows,要求生成杨辉三角的前 numRowsnumRowsnumRows 行。在杨辉三角中,每个数字都是它左上方和右上方数字的和。


思路

P4415.LeetCode.118.杨辉三角

    1000ms Tried: 3 Accepted: 3 Difficulty: 3
    算法与标签>动态规划

Leetcode 118.杨辉三角-原题链接

题目内容

给定一个非负整数 numRowsnumRowsnumRows,生成「杨辉三角」的前 numRowsnumRowsnumRows 行。

在「杨辉三角」中,每个数是它左上方和右上方的数的和。

img

输入描述

一个非负整数 numRowsnumRowsnumRows

输出描述

输出杨辉三角的前numRowsnumRowsnumRows行

样例1

输入

5

输出

1
1 1
1 2 1
1 3 3 1
1 4 6 4 1

样例2

输入

1

输出

1

提示

  • 1<=numRows<=301 <= numRows <= 301<=numRows<=30

登录后即可使用 AI 分析。

模式
倒计时时长
:

最长 10 小时 59 分;应用后按此时长重新开始。

提示:点击提交记录在左侧题面区域查看详情
题库
AI分析设置
留空使用官方API Key,每天有次数限制(自定义API Key仅限会员和管理员使用,不限次数)
会员和管理员可切换模型;切到 Kimi/智谱/通义/豆包时需填写对应供应商 API Key
升级会员,可将运行与提交冷却时间缩短至 1 秒起

Status

  • Judging Queue
  • Service Status

Development

  • Open Source

Support

  • Help
  • Contact Us

About

  • About
  • Privacy
  • Terms of Service
  • Copyright Complaint
  1. Language
    1. English
    2. 한국어
    3. 简体中文
    4. 正體中文
  2. Legacy mode
  3. Theme
    1. Light
    2. Dark
  1. 京ICP备2025123107号-1
  2. Worker 1, 19ms
  3. Powered by Hydro v5.0.0-beta.18 Community
CLOSE


ScanQRCodePrompt

请使用微信扫描下方二维码完成注册

Forgot password or username?