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;
}
相关推荐
啊哦呃咦唔鱼8 分钟前
LeetCode hot100-543 二叉树的直径
算法·leetcode·职场和发展
算法鑫探1 小时前
10个数下标排序:最大值、最小值与平均值(下)
c语言·数据结构·算法·排序算法·新人首发
样例过了就是过了1 小时前
LeetCode热题100 爬楼梯
c++·算法·leetcode·动态规划
少司府1 小时前
C++基础入门:类和对象(中)
c语言·开发语言·c++·类和对象·运算符重载·默认成员函数
ThisIsMirror2 小时前
leetcode 452 Arrays.sort()排序整数溢出、Integer.compare(a[1], b[1])成功的问题
算法·leetcode
爱编码的小八嘎2 小时前
C语言完美演绎7-5
c语言
x_xbx3 小时前
LeetCode:438. 找到字符串中所有字母异位词
算法·leetcode·职场和发展
REDcker3 小时前
OpenSSL:C 语言 TLS 客户端完整示例
c语言·网络·数据库
派大星~课堂3 小时前
【力扣-94.二叉树的中序遍历】Python笔记
笔记·python·leetcode
AI成长日志4 小时前
【笔面试算法学习专栏】堆与优先队列实战:力扣hot100之215.数组中的第K个最大元素、347.前K个高频元素
学习·算法·leetcode