Find any permutation of Binary String of given size not present in Array | Function to find a binary string of N bits that does not occur in the givrn array arr [ ] ; Stores the resultant string ; Loop to iterate over all the given strings in a diagonal order ; Append the complement of element at current index into ans ; Return Answer ; Driver code
function findString ( arr , N ) { let ans = " " ; for ( let i = 0 ; i < N ; i ++ ) { ans += arr [ i ] [ i ] == ' ' ? ' ' : ' ' ; } return ans ; } let arr = [ " " , " " , " " ] ; let N = arr . length ; document . write ( findString ( arr , N ) ) ;