Pascal Triangle Problem

Pascal Triangle Problem — ExecCode School DSA Practice

Solve the Pascal Triangle problem on ExecCode. Free online school DSA practice in Math. Write and run code in Java, C++, Python — no signup required to run.

Problem description

You are given a whole number N. Your task is to print the first N rows of Pascal's triangle. Follow the spacing shown in the examples.

Examples

Input 1; Output [[1]]. Input 2; Output [[1], [1, 1]]

Constraints

1 <= N <= 30

Practice Pascal Triangle free on ExecCode. Browse DSA problems, topic map, and placement guides.