If this is a leaf node and path to this node has maximum sum so far , then make this node target_leaf
if ( Node . left == None and Node . right == None ) : NEW_LINE INDENT if ( curr_sum > max_sum_ref ) : NEW_LINE INDENT max_sum_ref = curr_sum NEW_LINE target_leaf_ref = Node NEW_LINE DEDENT DEDENT