Path is allowed if size of present node becomes 0 i . e it has no child root and no more than m consecutive 1 's
if ( adj [ node ] . Count == 1 && node != 1 ) { ans ++ ; } foreach ( int x in adj [ node ] ) { if ( visited [ x ] == 0 ) { dfs ( x , count , m , arr , k ) ; } } }