Attempt 1

gyan pelo:

so to create a string of same length all combinations of a string will need to be calculated and then matched with the nums array to see which number is not present in nums array, there can be multiple answers.

to create combinations the striver method can be used with recursion it will cost 2^n tc and will work by mutltiple recursion, first push current element in temp array then call the method itself again, then remove from temp array and call the recursion method again.

there can be another way, create an array of n length, there can be three values in each cell indicating if 1 and 0 have occured in that place.

how to convert binary to integer?

convert to decimal, then sort it and find which two adjacent element don’t have different of 1. tc n log n

is tc n possible?

there is mathematical_trick used here with diagonal element

var findDifferentBinaryString = function(nums) {
    let result = '';
    for (var i = 0; i < nums.length; i++) {
        const diagonal = nums[i][i];
        const val = diagonal === '1' ? '0' : '1';
        result += val;
    }
    return result;
};