GUPTA MECHANICAL

IN THIS WEBSITE I CAN TELL ALL ABOUT TECH. TIPS AND TRICKS APP REVIEWS AND UNBOXINGS ALSO TECH. NEWS .............

Sunday 19 June 2022

[Solution] Zero Ones Equal One Zeros CodeChef Solution

Kulyash believes in equality.
Given an integer N, output a binary string of length N such that:

  • The count of 01 subsequences in the string is equal to the count of 10 subsequences;
  • The string has at least one occurrence of 0 as well as 1.

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 T, number of test cases. Then the test cases follow.
Solution Click Below:-  CLICK HERE

  • Each test case contains of a single line of input, an integer N - the length of the binary string.

Output Format

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







Constraints

  • 1T100

No comments:

Post a Comment