Different String solution codechef- You are given NN binary strings of length NN each. You need to find a binary string of length NN which is different from all of the given strings. Note: A binary string is defined as a string consisting only of ‘0’ and ‘1’. A string is considered different from another string when they have different lengths, or when they differ in at least one position.

Different String solution codechef

You are given NN binary strings of length NN each. You need to find a binary string of length NN which is different from all of the given strings.

Note:

  • A binary string is defined as a string consisting only of '0' and '1'.
  • A string is considered different from another string when they have different lengths, or when they differ in at least one position.

Input Format Different String solution codechef

  • The first line will contain TT – the number of test cases. Then the test cases follow.

  • The first line of each test case contains NN – the number of strings and length of strings.

  • Each of the next NN lines contains a binary string of length NN.

Output Format

For each test case, print on one line a binary string of length NN, which is different from all of the given strings. If there are multiple possible answers, print any.

Constraints

  • 1T1001≤T≤100
  • 1N1001≤N≤100

Sample Input 1  Different String solution codechef 

2
3
101
110
100
4
1100
1010
0100
0010

Sample Output 1 

111
1101

Explanation

Test case 11: 111111 is different from 101101 , 110110 , 100100.

Test case 22: 11011101 is different from 11001100 , 10101010 , 01000100 , 00100010.

Leave a Comment