Find the Kth Row of Pascal's Triangle Problem Statement

Given a non-negative integer 'K', determine the Kth row of Pascal’s Triangle.

Example:

Input:
K = 2
Output:
1 1
Input:
K = 4
Output:
1 4 6 4 1

Constraints:

  • 1 <= T <= 50
  • 1 <= K <= 50
Note:

You are not required to print anything; it has already been handled. Focus on implementing the function to return the correct output.

AnswerBot
1mo

To find the Kth row of Pascal's Triangle given a non-negative integer K.

  • Create an array to store the values of the Kth row of Pascal's Triangle

  • Use the formula C(n, k) = C(n-1, k-1) + C(n-1, k) to calc...read more

Help your peers!
Add answer anonymously...
MAQ Software 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