DSA_Worksheet icon indicating copy to clipboard operation
DSA_Worksheet copied to clipboard

Print Pascal's Triangle

Open Chitresh-code opened this issue 1 year ago • 8 comments

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?

Chitresh-code avatar Oct 19 '23 16:10 Chitresh-code

assign me

Chetan-KH511 avatar Oct 19 '23 16:10 Chetan-KH511

assign me

Anjali0109 avatar Oct 19 '23 16:10 Anjali0109

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

awsmdeep avatar Oct 19 '23 16:10 awsmdeep

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

Chitresh-code avatar Oct 19 '23 17:10 Chitresh-code

please assign this issue to me

Somil-Shukla avatar Oct 21 '23 09:10 Somil-Shukla

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

Shreshth-Srivastava avatar Oct 21 '23 10:10 Shreshth-Srivastava

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

AshaHolla avatar Oct 22 '23 10:10 AshaHolla

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

Pankaj4152 avatar Oct 26 '23 01:10 Pankaj4152