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 and abs ( totalSum - 2 * Sum ) < res [ 0 ] ) : NEW_LINE INDENT res [ 0 ] = abs ( totalSum - 2 * Sum ) NEW_LINE DEDENT