Hostages

 Practice Questions 

 Hostages 

 Problem Statement 

Professor have barricades of different length and he wants to store hostages by making a boundary using those barricades, but the professor realized that he can only use three barricades to store a group and they should be attached end to end so no one can escape, tell the professor how many possible ways are to assemble barricades.

 Boundary Condition(s) 

1 <= t <= 10³
1 <= n <= 10³
1 <= a[i] <= 10

 Input Format 

First line represents the number of test cases.
Second line represents the number of barricades.
Third line represents the input array.

 Output Format 

Total possibility to arrange barricades.

 Example Input/Output 1 

 Input 

1
5
6 7 4 9 1

 Output 

4

 Explanation 

Possible arrangements are
9 4 7
9 4 6
7 4 6
7 4 9
so there are 4 possible arrangements.

Solution for Hostage

Comments

Anonymous said…
Please post code after sometime bro

Popular Posts

Vaccine Distribution

String Rotation Odd and Even Positions

Highly Profitable Months

Largest Integer

Desktop Products

Words Starting with Upper Case

Find Maxima/Minima