Store the min difference
sub [ u ] = minDivisorDifference ( u ) ; let mx = 0 ; for ( let c = 0 ; c < g [ u ] . length ; c ++ ) { if ( g [ u ] != par ) { let ans = dfs ( g , g [ u ] , u ) ; mx = Math . max ( mx , ans ) ; } }