#K94132. HoloBinary Generation
HoloBinary Generation
HoloBinary Generation
You are given an even integer N. Your task is to generate all valid HoloBinary numbers of length N. A HoloBinary number is defined as a binary string of length N which contains exactly \(\frac{N}{2}\) zeros and \(\frac{N}{2}\) ones. The generated binary strings should be listed in lexicographical order.
Note: It is guaranteed that N will always be an even integer.
inputFormat
The input is read from the standard input and consists of multiple test cases. The first line contains a single integer T denoting the number of test cases. Then, T lines follow; each line contains one even integer N, representing the length of the binary string to be generated.
Example:
2 2 4
outputFormat
For each test case, output all valid HoloBinary numbers, each on a separate line. The binary strings for different test cases should be separated by an empty line.
Example corresponding to the input above:
01 10## sample</p>0011 0101 0110 1001 1010 1100
2
2
4
01
10
0011
0101
0110
1001
1010
1100
</p>