码迷,mamicode.com
首页 > 其他好文 > 详细

LeetCode Invert Binary Tree

时间:2015-06-13 11:27:30      阅读:234      评论:0      收藏:0      [点我收藏+]

标签:tree

LeetCode Invert Binary Tree

题目

技术分享

思路

没什么思路可言;
真不敢相信他写不出;

代码

struct TreeNode* invertTree(struct TreeNode* root) {
    if (root == NULL) return root;
    invertTree(root->left);
    invertTree(root->right);
    struct TreeNode * temp = root->left;
    root->left = root->right;
    root->right = temp;
    return root;
}

LeetCode Invert Binary Tree

标签:tree

原文地址:http://blog.csdn.net/u012925008/article/details/46480645

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!