Unacademy quiz doubt

Given a bracket sequence of length 1200, (i.e. a string s = s_0, s_1, \dots s_{1199} containing only ‘(‘ and ‘)’) with exactly 1000 open brackets and 200 close brackets, what is the maximum possible number of cyclic permutations of the string s that are open bracket sequences ?

A bracket sequence is said to be open, if for every prefix of the sequence, the number of open brackets is strictly more than, the number of close brackets.

An open bracket sequence can be made into a correct bracket sequence by adding some closing brackets to the end, and no prefix of the sequence is a correct bracket sequence.

A cyclic permutation of the string s_0s_1\dots s_{n-1} is a string s_i s_{i+1}\dots s_{n-1}s_0 s_1 \dots s_{i-1} , i.e. the elements of the string are shifted cyclically.

There are exactly n cyclic permutations of the string s
ans -800

Please expalin this problm.

hello @Somasree

it will be 800.
and the sequence whose cyclic perm will give this is as follows

( () () () …200 times … ( ( ( …799 times

Can you plz elaborate more

…

A bracket sequence is said to be open, if for every prefix of the sequence, the number of open brackets is strictly more than, the number of close brackets.

look at the definition, it says a valid permutation must have open > close at evrery index.

so first i consumed all closed brackets by forming this type of bracket ().
now if u notice such brackets will have always open ==close

but we want open > close for that i placed one addtion ( in the start .

( () () () … so that why this is the sequnece in starting.

now 201 open brcakets are consumed , put remaining 1000-201=799 brackets in the end
( ()…200 times …(…799 times

ok thank u uunderstood

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.