Binary String MEX MEXSTR Solution

Binary String MEX MEXSTR April Long Challenge 2021

You are given a binary string S. Chef defines MEX(S) as the smallest non-negative integer such that its binary representation (without leading ‘0’-s; in particular, the binary representation of 0 is “0”) is not a subsequence of S.

Chef is asking you to find MEX(S). Since this integer could be very large, find its binary representation (without leading ‘0’-s).

The first line of the input contains a single integer T denoting the number of test cases. The description of T test cases follows.
The first and only line of each test case contains a single string S.
For each test case, print a single line containing one string: MEX(S) in binary representation.

S contains only characters ‘0’ and ‘1’
the sum of |S| over all test cases does not exceed 2⋅106
Subtask #1 (20 points):

Subtask #2 (20 points):

Subtask #2 (60 points):

original constraints
Sample Input
Example Output
Example case 1: All integers between 0 and 11 inclusive, in binary representation, appear in S as subsequences. However, the binary representation of 12 (which is “1100”) is not a subsequence of S.

Example case 2: Since S contains only ‘1’-s, the string “0” is not a subsequence of S and therefore MEX(S)=0.

April Long Challenge 2021 Solutions

Codechef Long Challenge Solutions

February Long Challenge 2021

1. Frog Sort Solution Codechef

2. Chef and Meetings Solution Codechef

3. Maximise Function Solution Codechef

4. Highest Divisor Solution Codechef

5. Cut the Cake Challenge Solution Codechef

6. Dream and the Multiverse Solution Codechef

7. Cell Shell Solution Codechef

8. Multiple Games Solution Codechef

9. Another Tree with Number Theory Solution Codechef

10. XOR Sums Solution Codechef

11. Prime Game Solution CodeChef

12. Team Name Solution Codechef

January Long Challenge 2021

November Challenge 2020 SOLUTION CodeChef

October Lunchtime 2020 CodeChef SOLUTIONS


Related :

Related :

Leave a Comment

nine − one =