at one side subtree sum is ' sum ' and other side subtree sum is ' totalSum ▁ - ▁ sum ' so their difference will be totalSum - 2 * sum , by which we 'll update  res
if ( u != 0 && abs ( totalSum - 2 * sum ) < res ) res = abs ( totalSum - 2 * sum ) ; }