https://www.codechef.com/CLUE2021/problems/CLUEC004

PROBLEM LINK: Contest Page | CodeChef

Practice

Author: Setter’s name

Tester: Tester’s name

Editorialist: Editorialist’s name

DIFFICULTY : BEGINNER

PREREQUISITES:

Nill

PROBLEM:

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

HHHH

HHHT, HHTH, HTHH, THHH

HHTT, HTHT, HTTH, THHT, THTH, TTHH

HTTT, THTT, TTHT, TTTH

TTTT

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?

QUICK EXPLANATION:

The nth number is taken as input and nth row of the pascal’s triangle is to be displayed.

EXPLANATION:

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

SOLUTIONS:

Setter's Solution

,[>++++++[-<-------->]>+++++++++[-<<<[->

+>+<<]>>[-<<+>>]>]<<[-<+>]]>+<<[->>[>]<[

[->+>+<<]<]>>[[-<+>]>]<<[<]<]>+++++++[-<+

++++++>]<.----->>[>]<-<[[<]<.>>[>]<[->+<]

[>>>>++++++++++<<<<[->+>>+>-[<-]<[->>+<<

<<[->>>+<<<]>]<<]>+[-<+>]>>>[-]>[-<<<<+>>

]<<<<]<[>++++++[<++++++++>-]<-.[-]<]<]

Tester's Solution

Same Person

Editorialist's Solution

Same Person