|
| 1 | +<h2><a href="https://leetcode.com/problems/pascals-triangle">Pascal's Triangle</a></h2> <img src='https://img.shields.io/badge/Difficulty-Easy-brightgreen' alt='Difficulty: Easy' /><hr><p>Given an integer <code>numRows</code>, return the first numRows of <strong>Pascal's triangle</strong>.</p> |
| 2 | + |
| 3 | +<p>In <strong>Pascal's triangle</strong>, each number is the sum of the two numbers directly above it as shown:</p> |
| 4 | +<img alt="" src="https://upload.wikimedia.org/wikipedia/commons/0/0d/PascalTriangleAnimated2.gif" style="height:240px; width:260px" /> |
| 5 | +<p> </p> |
| 6 | +<p><strong class="example">Example 1:</strong></p> |
| 7 | +<pre><strong>Input:</strong> numRows = 5 |
| 8 | +<strong>Output:</strong> [[1],[1,1],[1,2,1],[1,3,3,1],[1,4,6,4,1]] |
| 9 | +</pre><p><strong class="example">Example 2:</strong></p> |
| 10 | +<pre><strong>Input:</strong> numRows = 1 |
| 11 | +<strong>Output:</strong> [[1]] |
| 12 | +</pre> |
| 13 | +<p> </p> |
| 14 | +<p><strong>Constraints:</strong></p> |
| 15 | + |
| 16 | +<ul> |
| 17 | + <li><code>1 <= numRows <= 30</code></li> |
| 18 | +</ul> |
0 commit comments