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;
}
相关推荐
superman超哥26 分钟前
仓颉锁竞争优化深度解析
c语言·开发语言·c++·python·仓颉
yaoh.wang1 小时前
力扣(LeetCode) 111: 二叉树的最小深度 - 解法思路
python·程序人生·算法·leetcode·面试·职场和发展·深度优先
qq_401700411 小时前
const 指针:内存安全锁
c语言
superman超哥1 小时前
仓颉语言中包与模块系统的深度剖析与工程实践
c语言·开发语言·c++·python·仓颉
努力学算法的蒟蒻2 小时前
day42(12.23)——leetcode面试经典150
算法·leetcode·面试
鹿角片ljp2 小时前
力扣226.翻转二叉树-递归
数据结构·算法·leetcode
iAkuya3 小时前
(leetcode)力扣100 21搜索二维矩阵2(z型搜索)
linux·leetcode·矩阵
(●—●)橘子……3 小时前
记力扣42.接雨水 练习理解
笔记·学习·算法·leetcode·职场和发展
Sheep Shaun4 小时前
STL:string和vector
开发语言·数据结构·c++·算法·leetcode
superman超哥5 小时前
仓颉语言导入语句使用深度解析
c语言·开发语言·c++·python·仓颉