Welcome to the daily solving of our PROBLEM OF THE DAY with Karan Masru. We will discuss the entire problem step-by-step and work towards developing an optimized solution. This will not only help you brush up on your concepts of Binary Tree but also build up problem-solving skills.
In this problem, we are given, a positive integer N, returning the Nth row of Pascal's triangle.
Pascal's triangle is a triangular array of binomial coefficients formed by summing up the elements of the previous row.
The elements can be large so return it modulo 10^9 + 7.
Example :
Input:
N = 4
Output:
1 3 3 1
Explanation:
4th row of Pascal's triangle is 1 3 3 1.
Give the problem a try before going through the video. All the best!!!
Problem Link: https://practice.geeksforgeeks.org/problems/pascal-triangle0652/1
Solution IDE Link: https://ide.geeksforgeeks.org/online-cpp-compiler/38ab13cc-0188-40b0-8f5f-2a59e153108b