The first line contains an integer 'T' denoting the number of test cases.
The first line and the only line of each test case contains a string 'STR' containing β1β, β0β, and β?β only.
For each test case, return all the possible strings in a sorted order(from lexicographically smallest to largest) that can be generated in the manner as described in the problem statement.
1. You donβt need to print anything, It has already been taken care of. Just implement the given function.
2. It is guaranteed that the number of special characters will not be more than 14.
1 <= T <= 50
1 <= |STR| <= 30
Where '|STR|' denotes the length of the string 'STR'.
Time limit: 1 sec
In this approach we will be using recursion to reach all the possible binary strings.
We will start by making a function named binaryStrings(). Inside this, we will make an integer variable named index(initialised to be 0).
For example: 1?0
In this approach we will be reaching all the possible binary strings iteratively. Can you guess what data structure weβll be using here? We will be using queue data structure to do this. We can also use stack, vector or any empty container to do this.
The steps are as follows:
For example: 1?0