Algorithm Puzzles: Pascal's Triangle
Algorithm Puzzles everyday every week sometimes: Pascal’s Triangle
Puzzle
Puzzle from leetcode:
Given an integer numRows, return the first numRows of Pascal’s triangle.
In Pascal’s triangle, each number is the sum of the two numbers directly above it as shown:
Example 1:
1 | Input: numRows = 5 |
Example 2:
1 | Input: numRows = 1 |
Solution
1 | class Solution { |
T.C.: O(N * N)