g0201_0300.s0226_invert_binary_tree.Solution Maven / Gradle / Ivy
package g0201_0300.s0226_invert_binary_tree;
import com_github_leetcode.TreeNode;
public class Solution {
public TreeNode invertTree(TreeNode root) {
if (root == null) {
return null;
}
TreeNode temp = root.left;
root.left = invertTree(root.right);
root.right = invertTree(temp);
return root;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy