if the node has not been visited set it and its children marked
for ( int i = 0 ; i < connectchars [ parent ] . Count ; i ++ ) { if ( ans [ connectchars [ parent ] [ i ] ] != 1 ) dfs ( connectchars [ parent ] [ i ] , ans , connectchars ) ; } } static void printBinaryPalindrome ( int n , int k ) { int [ ] arr = new int [ n ] ; int [ ] ans = new int [ n ] ;