Golang | Leetcode Golang题解之第226题翻转二叉树

题目:

题解:

func invertTree(root *TreeNode) *TreeNode {
    if root == nil {
        return nil
    }
    left := invertTree(root.Left)
    right := invertTree(root.Right)
    root.Left = right
    root.Right = left
    return root
}

相关推荐

  1. 力扣226翻转

    2024-07-11 06:34:02       23 阅读

最近更新

  1. docker php8.1+nginx base 镜像 dockerfile 配置

    2024-07-11 06:34:02       53 阅读
  2. Could not load dynamic library ‘cudart64_100.dll‘

    2024-07-11 06:34:02       55 阅读
  3. 在Django里面运行非项目文件

    2024-07-11 06:34:02       46 阅读
  4. Python语言-面向对象

    2024-07-11 06:34:02       56 阅读

热门阅读

  1. 东莞酷得 PMS134应广8位OTP单片机

    2024-07-11 06:34:02       18 阅读
  2. 大数据面试题之ElasticSearch(2)

    2024-07-11 06:34:02       17 阅读
  3. 单片机GPIO的八种工作模式

    2024-07-11 06:34:02       20 阅读
  4. 《火纹:风花雪月》种植最优化问题

    2024-07-11 06:34:02       21 阅读
  5. linux编写驱动程序常用API

    2024-07-11 06:34:02       19 阅读
  6. Scikit-Learn 教程1

    2024-07-11 06:34:02       22 阅读
  7. 数据库系统安全

    2024-07-11 06:34:02       16 阅读
  8. 【技术点】嵌入式技术考点一:C语言

    2024-07-11 06:34:02       13 阅读
  9. 【Spring Boot 异常处理】

    2024-07-11 06:34:02       15 阅读
  10. Linux离线安装redis

    2024-07-11 06:34:02       22 阅读
  11. Memcached介绍和详解

    2024-07-11 06:34:02       18 阅读
  12. Python的入门知识(上)

    2024-07-11 06:34:02       21 阅读