If this is a leaf node and path to this node has maximum sum so far , the n make this node target_leaf
if ( node . left == null && node . right == null ) { if ( curr_sum > max_sum_ref . max_no ) { max_sum_ref . max_no = curr_sum ; target_leaf = node ; } }