C语言 | Leetcode C语言题解之第226题翻转二叉树

题目:

题解:

cpp 复制代码
struct TreeNode* invertTree(struct TreeNode* root) {
    if (root == NULL) {
        return NULL;
    }
    struct TreeNode* left = invertTree(root->left);
    struct TreeNode* right = invertTree(root->right);
    root->left = right;
    root->right = left;
    return root;
}
相关推荐
S01d13r2 小时前
LeetCode 解题思路 48(编辑距离、只出现一次的数字)
算法·leetcode·职场和发展
C_Liu_2 小时前
C语言:深入理解指针(5)
java·c语言·算法
small_wh1te_coder2 小时前
从经典力扣题发掘DFS与记忆化搜索的本质 -从矩阵最长递增路径入手 一步步探究dfs思维优化与编程深度思考
c语言·数据结构·c++·stm32·算法·leetcode·深度优先
枫景Maple2 小时前
LeetCode 45. 跳跃游戏 II(中等)
算法·leetcode
এ᭄画画的北北2 小时前
力扣-236.二叉树的最近公共祖先
算法·leetcode
XiaoyaoCarter6 小时前
每日一道leetcode(新学数据结构版)
数据结构·c++·算法·leetcode·职场和发展·哈希算法·前缀树
freyazzr7 小时前
Leetcode刷题 | Day63_图论08_拓扑排序
数据结构·c++·算法·leetcode·图论
邹诗钰-电子信息工程8 小时前
嵌入式自学第二十二天(5.15)
c语言
Swift社区9 小时前
LeetCode 高频题实战:如何优雅地序列化和反序列化字符串数组?
算法·leetcode·职场和发展
范纹杉想快点毕业10 小时前
以项目的方式学QT开发(一)——超详细讲解(120000多字详细讲解,涵盖qt大量知识)逐步更新!
c语言·数据结构·c++·git·qt·链表·github