Chitresh-code / DSA_Worksheet

Worksheet posting DSA problems every day for GNIOT Students to solve and create PR's.
MIT License
17 stars 34 forks source link

Print Pascal's Triangle #42

Open Chitresh-code opened 10 months ago

Chitresh-code commented 10 months ago

Write Code in Only One Language (CPP, C, Java, Python)

Give File Name : pascal_triangle ✅ In respective language folder

📑 DESCRIPTION

Pascal's Triangle

Difficulty

Problem Statement: You are given an integer ‘N’. You need to return the first ‘N’ rows of Pascal’s triangle.

Example

Input:
N = 4
Output:
1
1 1
1 2 1
1 3 3 1
Explanation: The output matrix has the first four rows of Pascal’s Triangle. 

Input Format:

The first line of the input will contain an integer ‘N’. 

Output Format:

Print the first ‘N’ rows of Pascal’s Triangle.

Sample Input 1

5

Sample Output 1

1
1 1
1 2 1
1 3 3 1
1 4 6 4 1

Explanation of Sample Input 1

Input:
N = 5

Output:
1
1 1
1 2 1
1 3 3 1
1 4 6 4 1
Explanation: The output matrix has the first five rows of Pascal’s Triangle.

Sample Input 2

3

Sample Output 2

1 
1 1
1 2 1

Constraints

1 <= N <= 30
Time Limit: 1 sec

What is Pascal's Triangle?

Chetan-KH511 commented 10 months ago

assign me

Anjali0109 commented 10 months ago

assign me

awsmdeep commented 10 months ago

hey @Chitresh-code i hope ur doing well ,can uu assign me this work

Chitresh-code commented 10 months ago

@awsmdeep @Anjali0109 @Chetan-KH511 assigned it to you

Somil-Shukla commented 10 months ago

please assign this issue to me

Shreshth-Srivastava commented 10 months ago

@Chitresh-code Hey there, I would like to contribute to this repository so could you please assign this issue to me.

AshaHolla commented 10 months ago

I would like to work on this, pls assign to me

Pankaj4152 commented 10 months ago

@Chitresh-code Can you please assign this to me?