PROBLEM LINK: Contest Page | CodeChef
Author: Setter’s name
Tester: Tester’s name
Editorialist: Editorialist’s name
DIFFICULTY : BEGINNER
Mr Sutty, a professor at Oxford on his first day is met with a challenge from his collegue. He is asked to predict the pattern of the number of unique combinations of heads and tails when a coin is tossed for a given number of times. For example, if a coin is tossed 4 times, the possible combinations are
HHHT, HHTH, HTHH, THHH
HHTT, HTHT, HTTH, THHT, THTH, TTHH
HTTT, THTT, TTHT, TTTH
Thus, the observed pattern is 1, 4, 6, 4,1 Mr. Sutty also found that when these patterns are ordered based on the number of times the coin is tossed, it forms a world famous pattern.Can you guess this pattern and help Mr.Sutty?
The nth number is taken as input and nth row of the pascal’s triangle is to be displayed.
Pascal’s triangle is a triangular array constructed by summing adjacent elements in preceding rows. Pascal’s triangle contains the values of the binomial coefficient.
First we need to input which row’s sequence is to be shown. After that we’ll iterate