mirror of
https://github.com/yangshun/tech-interview-handbook.git
synced 2025-07-28 04:33:42 +08:00
Squash commit
This commit is contained in:
10
utilities/treeMirror.js
Normal file
10
utilities/treeMirror.js
Normal file
@ -0,0 +1,10 @@
|
||||
function treeMirror(node) {
|
||||
if (!node) {
|
||||
return;
|
||||
}
|
||||
let temp = node.left;
|
||||
node.left = node.right;
|
||||
node.right = temp;
|
||||
treeMirror(node.left);
|
||||
treeMirror(node.right);
|
||||
}
|
Reference in New Issue
Block a user