DFS method to traverse through edges , calculating subtree sum at each node and updating the difference between subtrees
void dfs ( int u , int parent , int totalSum , vector < int > edge [ ] , int subtree [ ] , int & res ) { int sum = subtree [ u ] ;