mirror of
				https://gitee.com/coder-xiaomo/leetcode-problemset
				synced 2025-11-04 03:33:12 +08:00 
			
		
		
		
	
		
			
				
	
	
		
			19 lines
		
	
	
		
			790 B
		
	
	
	
		
			HTML
		
	
	
	
	
	
			
		
		
	
	
			19 lines
		
	
	
		
			790 B
		
	
	
	
		
			HTML
		
	
	
	
	
	
<p>Given an integer <code>numRows</code>, return the first numRows of <strong>Pascal's triangle</strong>.</p>
 | 
						|
 | 
						|
<p>In <strong>Pascal's triangle</strong>, each number is the sum of the two numbers directly above it as shown:</p>
 | 
						|
<img alt="" src="https://upload.wikimedia.org/wikipedia/commons/0/0d/PascalTriangleAnimated2.gif" style="height:240px; width:260px" />
 | 
						|
<p> </p>
 | 
						|
<p><strong class="example">Example 1:</strong></p>
 | 
						|
<pre><strong>Input:</strong> numRows = 5
 | 
						|
<strong>Output:</strong> [[1],[1,1],[1,2,1],[1,3,3,1],[1,4,6,4,1]]
 | 
						|
</pre><p><strong class="example">Example 2:</strong></p>
 | 
						|
<pre><strong>Input:</strong> numRows = 1
 | 
						|
<strong>Output:</strong> [[1]]
 | 
						|
</pre>
 | 
						|
<p> </p>
 | 
						|
<p><strong>Constraints:</strong></p>
 | 
						|
 | 
						|
<ul>
 | 
						|
	<li><code>1 <= numRows <= 30</code></li>
 | 
						|
</ul>
 |