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;
}
相关推荐
falldeep1 小时前
Pandas入门指南
数据结构·算法·leetcode·pandas
闲看云起1 小时前
Leetcode-day4:从「移动零」到「盛最多水的容器」
数据结构·算法·leetcode·职场和发展
圣保罗的大教堂2 小时前
leetcode 840. 矩阵中的幻方 中等
leetcode
sin_hielo3 小时前
leetcode 840
数据结构·算法·leetcode
一路往蓝-Anbo3 小时前
C语言从句柄到对象 (一) —— 全局变量的噩梦与“多实例”的救赎
c语言·开发语言·stm32·单片机·嵌入式硬件·物联网
松涛和鸣4 小时前
DAY42 SQLite3 : Dictionary Import and Data Query Implementation with C Language
linux·c语言·数据库·单片机·网络协议·sqlite
水饺编程4 小时前
Visual Studio 软件操作:添加附加依赖项
c语言·c++·windows·visual studio
十八岁讨厌编程5 小时前
【算法训练营 · 补充】LeetCode Hot100(下)
算法·leetcode·职场和发展
一路往蓝-Anbo5 小时前
C语言从句柄到对象 (三) —— 抛弃 Malloc:静态对象池与索引句柄的终极形态
c语言·开发语言·数据结构·stm32·单片机·算法
序属秋秋秋5 小时前
《Linux系统编程之进程控制》【进程创建 + 进程终止】
linux·c语言·c++·操作系统·进程·进程创建·进程终止