Stucked with the question

I’m not getting how to solve this question.
please help me out with this…
The link for the question is
https://online.codingblocks.com/player/7373/content/5135

Mention problem name

Hey!

Solution of the problem is a brute force, as range of n is 1<= n<= 5.
you have to consider all possible combination of using the n pipes and then select the one with minimum value.

Total number of combination would be: 32*120.

32 = 2^5= total number of set of n pipes,
120= 5!= all permutation of those n pipes, so for all set we will have max 120 permutation.

Hit like if you get it!
Cheers Coding.

I got the explanation.

I got the explanation. It’s giving WA but my code passes the testcases that are given in the problem statement. Can u tell where it’s going wrong.

https://ide.codingblocks.com/s/59437. This is the link to my code.