技术栈

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动态防护功能初体验
相关推荐
开源Z
20 小时前
LeetCode 42 · 接雨水:从暴力到双指针的三步优化
算法·leetcode
十月的皮皮
21 小时前
C语言学习笔记20260615-有序升序序列合并
c语言·笔记·学习
玖玥拾
1 天前
C/C++ 数据结构(六)链表迭代器与底层
c语言·数据结构·c++·链表·stl库
Seraphina_Lily
1 天前
深入C语言底层:隐式类型转换、整数提升与截断的“致命”陷阱
c语言·开发语言·算法
C++ 老炮儿的技术栈
1 天前
Ubuntu root账号自动登陆
linux·运维·服务器·c语言·c++·ubuntu·visual studio
圣保罗的大教堂
1 天前
leetcode 2130. 链表最大孪生和 中等
leetcode
blxr_
1 天前
力扣hot100路径总和Ⅲhttps://leetcode.cn/problems/path-sum-iii/
算法·leetcode·职场和发展
noipp
1 天前
【无标题】
c语言·数据结构·c++·算法
超皮小龙猫
1 天前
c语言-1
c语言·开发语言
热门推荐
012026年6月AI行业全景:从百模大战到Agent元年,这30天发生了什么?022026 AI 编程工具终极实战指南:Cursor vs Claude Code vs Copilot,开发者该怎么选?032026 年 AI 编程工具终极横评:Cursor vs Claude Code vs Copilot vs Windsurf04【AI】2026 年具身智能模型和世界模型总结05GitHub 镜像站点06HTTP 与 HTTPS 的区别:从原理到实战详解07上线仅72小时被强制下架:Claude Fable 5 的短命082026年6月AI大模型全景报告:GPT-5.6、Claude Opus 4.8、Gemini 3.5,中美AI三足鼎立谁主沉浮?09AI科技热点日报 | 2026年6月1日10Codex 下载安装指南:Windows 和 macOS 官方版下载