【力扣】226. 翻转二叉树

226. 翻转二叉树

【力扣】226. 翻转二叉树_第1张图片

var invertTree = function(root){
    if(root == null) return null;
    let tmp = root.left;
    root.left = root.right;
    root.right = tmp;
    intertTree(root.left);
    intertTree(root.right);
    return root;
}

你可能感兴趣的:(leetcode,算法,职场和发展)