Pascal's Triangle Problem Statement
You are provided with an integer N
. The objective is to return a 2-dimensional list representing Pascal’s triangle up to row N
.
A Pascal's triangle is a triangular array where each entry is the sum of the two entries directly above it in the previous row, representing binomial coefficients.
Example:
Input:
N = 4
Output:
[[1], [1, 1], [1, 2, 1], [1, 3, 3, 1]]
Constraints:
1 ≤ T ≤ 40
1 ≤ N ≤ 50
Note: You do not need to print the list; just return the 2-dimensional list from the function. Each test case should be independently computed.
Be the first one to answer
Add answer anonymously...
Top ServiceNow Software Engineer interview questions & answers
Popular interview questions of Software Engineer
Top HR questions asked in ServiceNow Software Engineer
Stay ahead in your career. Get AmbitionBox app
Helping over 1 Crore job seekers every month in choosing their right fit company
65 L+
Reviews
4 L+
Interviews
4 Cr+
Salaries
1 Cr+
Users/Month
Contribute to help millions
Get AmbitionBox app