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;
}
相关推荐
金池尽干几秒前
基于C语言的基数排序算法
c语言·算法·排序算法
Z3r4y5 小时前
【Web】PolarCTF2024秋季个人挑战赛wp
web·ctf·题解·wp·polarctf·polarctf秋季赛
我要学编程(ಥ_ಥ)5 小时前
双指针算法专题(2)
数据结构·算法·leetcode
Xxxx. .Xxxx6 小时前
C语言程序设计实验与习题指导 (第4版 )课后题-第二章+第三章
java·c语言·开发语言
我要学编程(ಥ_ಥ)7 小时前
滑动窗口算法专题(1)
java·数据结构·算法·leetcode
DogDaoDao7 小时前
Windows 环境下 vscode 配置 C/C++ 环境
c语言·c++·windows·vscode·gcc·mingw-w64
Beginner_bml7 小时前
结构体---C语言
c语言·开发语言·数据结构
LluckyYH7 小时前
代码随想录Day 46|动态规划完结,leetcode题目:647. 回文子串、516.最长回文子序列
数据结构·人工智能·算法·leetcode·动态规划
huanxiangcoco8 小时前
73. 矩阵置零
python·leetcode·矩阵
源代码:趴菜8 小时前
LeetCode118:杨辉三角
算法·leetcode·动态规划