Path Sum
来源:互联网 发布:软件著作权侵权认定 编辑:程序博客网 时间:2024/06/06 03:45
/** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode(int x) : val(x), left(NULL), right(NULL) {} * }; */class Solution {public: bool hasPathSum(TreeNode* root, int sum) { if(root==NULL) return false; if(root->left==NULL&&root->right==NULL&&root->val==sum) return true; return hasPathSum(root->left,sum-root->val)||hasPathSum(root->right,sum-root->val); }};
0 0
- Path Sum && Path Sum ||
- Path Sum
- Path Sum
- Path Sum
- Path Sum
- Path Sum
- Path Sum
- Path Sum
- Path Sum
- Path Sum
- Path Sum
- Path Sum
- Path Sum
- Path Sum
- Path Sum
- Path Sum
- Path Sum
- Path Sum
- iOS地图位置开发
- POJ 1905 - Expanding Rods 【二分/三分】
- ln: creating symbolic link XXXXXX : Operation not supported
- 关于熵的数学基础
- ARM MMU 详解
- Path Sum
- 基本数据类型的一些特别的操作方法小结
- UIView常用方法之setNeedsDisplay和setNeedsLayout
- [多校2015.02.1004 dp] hdu 5303 Delicious Apples
- SVN使用教程
- Linux下 mantisbt安装使用说明
- python datetime模块详解
- Android默认输入法语言的修改以及SettingsProvider作用
- Android中关于APK对遥控器支持的修改