Invert Binary Tree LeetCode solution in JavaScript

1
var invertTree = function (root) {
2
if (!root) return root;
3
[root.left, root.right] = [root.right, root.left];
4
invertTree(root.right);
5
invertTree(root.left);
6
return root;
7
};

0

WPM •0 •0

100%

ACC •0 •0

0s

TIME •0