递归,dfs这里返回值是一个pair,first表示两个子树的不经过当前root的最大pathsum;second表示两个子树的,以root->left和root->right为路径起始节点的路径的最大值 1 /** 2 * Definition for binary tree 3 * stru.....
分类:
其他好文 时间:
2014-09-07 19:43:15
阅读次数:
195
class Solution {public: int minPathSum(vector > &grid) { int rows = grid.size(); if (rows pathsum(cols + 1, INT_MAX); pathsum...
分类:
其他好文 时间:
2014-06-30 13:23:04
阅读次数:
153
PathsumDescription:Given a binary tree and a
sum, determine if the tree has a root-to-leaf path such that adding up all the
values along the path equa...
分类:
其他好文 时间:
2014-06-08 01:11:46
阅读次数:
395