MCPcopy Create free account
hub / github.com/neetcode-gh/leetcode / dfs

Function dfs

javascript/0226-invert-binary-tree.js:14–22  ·  view source on GitHub ↗
(root)

Source from the content-addressed store, hash-verified

12};
13
14const dfs = (root) => {
15 const left = invertTree(root.left);
16 const right = invertTree(root.right);
17
18 root.left = right;
19 root.right = left;
20
21 return root;
22};
23
24/**
25 * https://leetcode.com/problems/invert-binary-tree/

Callers 1

invertTreeFunction · 0.70

Calls 1

invertTreeFunction · 0.70

Tested by

no test coverage detected