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 ] . size ( ) == 1 && node != 1 ) { ans ++ ; } for ( auto x : adj [ node ] ) { if ( ! visited [ x ] ) { dfs ( x , count , m , arr , k ) ; } } }