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...
ServiceNow Software Engineer Interview Questions
Stay ahead in your career. Get AmbitionBox app
qr-code
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

Made with ❤️ in India. Trademarks belong to their respective owners. All rights reserved © 2024 Info Edge (India) Ltd.

Follow us
  • Youtube
  • Instagram
  • LinkedIn
  • Facebook
  • Twitter