技术栈

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

DdddJMs__1352024-07-10 16:24

题目:

题解:

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;
}
上一篇:探究kubernetes 探针参数periodSeconds和timeoutSeconds
下一篇:雷池WAF动态防护功能初体验
相关推荐
RuoZoe
4 天前
重塑WPF辉煌?基于DirectX 12的现代.NET UI框架Jalium
c语言
祈安_
7 天前
C语言内存函数
c语言·后端
norlan_jame
9 天前
C-PHY与D-PHY差异
c语言·开发语言
琢磨先生David
9 天前
Day1:基础入门·两数之和(LeetCode 1)
数据结构·算法·leetcode
czy8787475
9 天前
除了结构体之外,C语言中还有哪些其他方式可以模拟C++的面向对象编程特性
c语言
m0_53123717
9 天前
C语言-数组练习进阶
c语言·开发语言·算法
超级大福宝
9 天前
N皇后问题:经典回溯算法的一些分析
数据结构·c++·算法·leetcode
Charlie_lll
9 天前
力扣解题-88. 合并两个有序数组
后端·算法·leetcode
菜鸡儿齐
9 天前
leetcode-最小栈
java·算法·leetcode
Frostnova丶
9 天前
LeetCode 1356. 根据数字二进制下1的数目排序
数据结构·算法·leetcode
热门推荐
01GitHub 镜像站点02OpenClaw 使用和管理 MCP 完全指南03OpenClaw + 飞书(Feishu)环境搭建指南04本地部署 OpenClaw + DeepSeek-R1 完全指南05Window 10部署openclaw报错node.exe : npm error code 12806OpenClaw优化飞书API 额度已耗尽问题07Claude Code + GLM4.7 避坑指南:解决 Unable to connect to Anthropic services08OpenClaw 连接飞书完整指南:插件安装、配置与踩坑记录09小黑课堂计算机二级WPSoffice题库软件下载安装教程(2026年3月最新版)10让 Trae IDE 智能体 “读懂”文档 Excel+PDF+DOCX :mcp-documents-reader 工具使用指南