LeetCode 100. Same Tree

Solution1:
这种弱智题提交这么多次。。。

/*** 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 isSameTree(TreeNode* p, TreeNode* q) {return my_Judge(p, q);}bool my_Judge(TreeNode* p, TreeNode* q) {if (p == NULL && q == NULL)return true;else if (p == NULL && q != NULL || q == NULL && p != NULL)return false;else if (p->val != q->val)return false;else {if (my_Judge(p->left, q->left) == false || my_Judge(p->right, q->right) == false)return false;elsereturn true;}}
};

LeetCode 100. Same Tree相关推荐

  1. [Leetcode]100. Same Tree -David_Lin

    Given two binary trees, write a function to check if they are equal or not. Two binary trees are con ...

  2. [LeetCode]: 100: Same Tree

    题目: Given two binary trees, write a function to check if they are equal or not. Two binary trees are ...

  3. [leetcode]100.Same Tree

    题目 Given two binary trees, write a function to check if they are the same or not. Two binary trees a ...

  4. leetcode 100.Same Tree

    这道题目我最初想的太多了,导致做了好久,之后从网上一看,一下醒悟过来,不难. 题目: Given two binary trees, write a function to check if they ...

  5. LeetCode 589. N-ary Tree Preorder Traversal-多子节点树前序遍历--递归,迭代--反向压栈--C++解法

    LeetCode 589. N-ary Tree Preorder Traversal-多子节点树前序遍历–递归,迭代–反向压栈–C++解法 LeetCode题解专栏:LeetCode题解 LeetC ...

  6. LeetCode: 107. Binary Tree Level Order Traversal II

    题目 Given a binary tree, return the bottom-up level order traversal of its nodes' values. (ie, from l ...

  7. LeetCode: 103. Binary Tree Zigzag Level Order Traversal

    题目 Given a binary tree, return the zigzag level order traversal of its nodes' values. (ie, from left ...

  8. LeetCode: Flatten Binary Tree to Linked List

    LeetCode: Flatten Binary Tree to Linked List LeetCode: Flatten Binary Tree to Linked List Given a bi ...

  9. 【重点】LeetCode 124. Binary Tree Maximum Path Sum

    LeetCode 124. Binary Tree Maximum Path Sum 参考链接:http://zxi.mytechroad.com/blog/tree/leetcode-124-bin ...

最新文章

  1. 5G NGC — 关键技术 — R16 eSBA
  2. 谷歌技术三宝之BigTable
  3. c++学习书籍推荐《Advanced C++》下载
  4. 利用matlab guide制作简易计算器
  5. 如何领导团队做好技术债管理?
  6. 【树】判断给定森林中有多少棵树(简单做法)
  7. Cmder 设置默认打开目录、解决中文乱码
  8. 火狐浏览器手机版_hao123导航app下载-hao123浏览器手机版下载
  9. H5测试是怎么做的?
  10. 【开源GPS追踪】 之 服务器端opengts安装
  11. 【教程】Edraw Max(亿图图示):使用免费模板和示例快速制作发票
  12. 使用CSS控制表单样式/示例演示
  13. c编程语言学习软件,用什么软件学习c语言
  14. 子群的陪集-》群的拉格朗日定理
  15. 计算机网络(2.10)物理层- 宽带接入技术-ADSL 技术
  16. Docker的Pull Digest和Image ID
  17. Sping Cloud专栏:路由Gateway有效避免 Only one connection receive subscriber allowed问题
  18. linux的ctrl alt f12,“Ctrl + Alt + F12”是做什么的?
  19. compiz的ubuntu10.04安装
  20. 【解决】Python程序运行时所占内存越来越大

热门文章

  1. 精通PHP的十大要点
  2. 图像处理之---双线性插值
  3. 树莓派4B安装Ubuntu20.04
  4. 怎么检测mysql查询是否慢_MySQL慢查询查找和调优测试
  5. linux的工程管理器是,Linux工程管理器——make
  6. 怎么在大数据里面删除不了_数据库删除大数据怎么操作
  7. python提前退出内层循环,python with提前退出遇到的坑与解决方案
  8. linux是用于汇编语言,深入理解程序设计:使用Linux汇编语言
  9. java中的枚举_Java中的枚举
  10. Spring ActiveMQ示例(第2部分)