Class Solution

java.lang.Object
g0101_0200.s0119_pascals_triangle_ii.Solution

public class Solution extends Object
119 - Pascal&rsquo;s Triangle II.<p>Easy</p> <p>Given an integer <code>rowIndex</code>, return the <code>rowIndexth</code> ( <strong>0-indexed</strong> ) row of the <strong>Pascal&rsquo;s triangle</strong>.</p> <p>In <strong>Pascal&rsquo;s triangle</strong> , each number is the sum of the two numbers directly above it as shown:</p> <p><img src="https://upload.wikimedia.org/wikipedia/commons/0/0d/PascalTriangleAnimated2.gif" alt="" /></p> <p><strong>Example 1:</strong></p> <p><strong>Input:</strong> rowIndex = 3</p> <p><strong>Output:</strong> [1,3,3,1]</p> <p><strong>Example 2:</strong></p> <p><strong>Input:</strong> rowIndex = 0</p> <p><strong>Output:</strong> [1]</p> <p><strong>Example 3:</strong></p> <p><strong>Input:</strong> rowIndex = 1</p> <p><strong>Output:</strong> [1,1]</p> <p><strong>Constraints:</strong></p> <ul> <li><code>0 <= rowIndex <= 33</code></li> </ul> <p><strong>Follow up:</strong> Could you optimize your algorithm to use only <code>O(rowIndex)</code> extra space?</p>
  • Constructor Details

    • Solution

      public Solution()
  • Method Details