[Leetcode] Same Tree
来源:互联网 发布:古墓丽影9a卡优化补丁 编辑:程序博客网 时间:2024/04/19 03:03
/** * Definition for binary tree * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode(int x) : val(x), left(NULL), right(NULL) {} * }; */class Solution {public: bool isSameTree(TreeNode *p, TreeNode *q) { // Start typing your C/C++ solution below // DO NOT write int main() function if (!p && !q) return true; else if (!p) return false; else if (!q) return false; else { if (p->val == q->val) return isSameTree(p->left, q->left) && isSameTree(p->right, q->right); else return false; } }};
- Leetcode - Tree - Same Tree
- [leetcode][tree] Same Tree
- LeetCode: Same Tree
- LeetCode Same Tree
- [Leetcode] Same Tree
- LeetCode : Same Tree
- [LeetCode] Same Tree
- leetcode 65: Same Tree
- Leetcode 100 Same Tree
- [leetcode] Same Tree
- [LeetCode]Same Tree
- [leetcode]Same Tree
- [Leetcode]Same Tree
- Leetcode: Same Tree
- [LeetCode] Same Tree
- LeetCode-Same Tree
- [leetcode] Same Tree
- LeetCode - Same Tree
- [Leetcode] Convert Sorted List to Binary Search Tree
- [Leetcode] Reverse Integer
- [Leetcode] Search a 2D Matrix
- [Android]点击外层lyout控件改变内层控件颜色
- [Leetcode] Search for a Range
- [Leetcode] Same Tree
- [Leetcode] Valid Parentheses
- [Leetcode] Validate Binary Search Tree
- asp.net 页面生命周期
- C# LIST 使用泛型
- 基数树(radix tree)
- apache-2.4.x 编译安装方法apache-2.4.x 编译安装方法
- SpringAOP
- 一、查看最大打开文件数