[Solution] Zero Ones Equal One Zeros solution codechef

Zero Ones Equal One Zeros solution codechef – Kulyash believes in equality.
Given an integer NN, output a binary string of length NN such that:

  • The count of 0101 subsequences in the string is equal to the count of 1010 subsequences;
  • The string has at least one occurrence of 00 as well as 11.

Table of Contents

[Solution] Zero Ones Equal One Zeros solution codechef

If multiple such strings exist, print any. Also, it is guaranteed that corresponding to the given input, an answer always exists.

Input Format

  • First line will contain TT, number of test cases. Then the test cases follow.
  • Each test case contains of a single line of input, an integer NN – the length of the binary string.

Output Format

For each test case, output any binary string of length NN satisfying the given conditions.

[Solution] Zero Ones Equal One Zeros solution codechef

  • 1T1001≤T≤100
  • 3N10003≤N≤1000

Subtasks

Sample Input 1 

2
4
3

[Solution] Zero Ones Equal One Zeros solution codechef

 

1001
010

Explanation

Test case 11: A binary string satisfying both the conditions is 10011001. The count of 0101 as well as 1010 subsequences in the string is 22.

Test case 22: A binary string satisfying both the conditions is 010010. The count of 0101 as well as 1010 subsequences in the string is 11.

For Solution

Click Here

Leave a Comment