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;
}
相关推荐
爱编码的小八嘎1 天前
C语言完美演绎9-12
c语言
样例过了就是过了1 天前
LeetCode热题 不同路径
c++·算法·leetcode·动态规划
Navigator_Z1 天前
LeetCode //C - 1031. Maximum Sum of Two Non-Overlapping Subarrays
c语言·算法·leetcode
如何原谅奋力过但无声1 天前
【灵神高频面试题合集01-03】相向双指针、滑动窗口
数据结构·python·算法·leetcode
leoufung1 天前
LeetCode 42:接雨水 —— 从“矩形法”到双指针的完整思考过程
java·算法·leetcode
_日拱一卒1 天前
LeetCode:543二叉树的直径
算法·leetcode·职场和发展
穿条秋裤到处跑1 天前
每日一道leetcode(2026.04.28):获取单值网格的最小操作数
算法·leetcode·职场和发展
leoufung1 天前
LeetCode 68. Text Justification 题解:贪心与实现细节
算法·leetcode·职场和发展
洛水水1 天前
【力扣100题】17.K 个一组翻转链表
算法·leetcode·链表
洛水水1 天前
【力扣100题】16.两两交换链表中的节点
算法·leetcode·链表