每日LeetCode - 101. 对称二叉树(C语言)
2021-05-28 02:02
阅读:775
标签:mamicode struct str include rgb ini div ima 技术
C语言
#include "stdbool.h" #define NULL ((void *)0) //Definition for a binary tree node. struct TreeNode { int val; struct TreeNode *left; struct TreeNode *right; }; bool check(struct TreeNode* p, struct TreeNode* q) { if (!p && !q) return true; if (!p || !q) return false; return p->val == q->val && check(p->left, q->right) && check(p->right, q->left); } bool isSymmetric(struct TreeNode* root) { return check(root, root); }
每日LeetCode - 101. 对称二叉树(C语言)
标签:mamicode struct str include rgb ini div ima 技术
原文地址:https://www.cnblogs.com/vicky2021/p/14806343.html
文章来自:搜素材网的编程语言模块,转载请注明文章出处。
文章标题:每日LeetCode - 101. 对称二叉树(C语言)
文章链接:http://soscw.com/index.php/essay/88472.html
文章标题:每日LeetCode - 101. 对称二叉树(C语言)
文章链接:http://soscw.com/index.php/essay/88472.html
评论
亲,登录后才可以留言!