if the node has not been visited set it and its children marked
for i in range ( len ( connectchars [ parent ] ) ) : NEW_LINE INDENT if ( not ans [ connectchars [ parent ] [ i ] ] ) : NEW_LINE INDENT dfs ( connectchars [ parent ] [ i ] , ans , connectchars ) NEW_LINE DEDENT DEDENT def printBinaryPalindrome ( n , k ) : NEW_LINE arr = [ 0 ] * n NEW_LINE ans = [ 0 ] * n NEW_LINE