Chef and Bracket-pair test case clarification

Can anyone of u plz explain why given test case’s output is 12 as i am getting more then 12 possible sequences they are -1 +1 , -1 -2 +2 +1, -1 -3 +3 +1,-1 -4 +4 +1, -1 -2 +2 -3 +3 +1,-1 -3 +3 -2 +2 ,-1 -4 +4 -2 +2 +1,-1 -2 +2 -4 +4 +1 ,-1 -3 +3 -4 +4 +1 ,-1 -4 +4 -3 +3 +1 and similarly for starting from -2 -3 -4 etc can i know for which of above sequence should not be accpetable … ?

How are, for example those two valid:

-1 -3 +3 -2 +2 1
-1 -4 +4 -2 +2 +1

?

As pointed out earlier the sub-sequences below are not valid :-

-1 -2 +3 -2 +2 1

-1 -4 +4 -2 +2 +1

A subsequence is something which is formed by original sequence by deleting some elements without changing the order .
hope that helps , go and get AC :slight_smile:

Thnx acodebreaker2 …

welcome , community is for help only :slight_smile:

Will all the integers be different??
i.e only one 1 can occur or is the input:
-1 -2 -3 3 2 -1 1 , possible?

It was already asked - http://discuss.codechef.com/questions/57497/december-challenge-chef-and-bracket-pairs