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

Function serial

javascript/0297-serialize-and-deserialize-binary-tree.js:14–19  ·  view source on GitHub ↗
(root, result)

Source from the content-addressed store, hash-verified

12};
13
14const serial = (root, result) => {
15 const isBase = root === null;
16 if (isBase) return result.push(null);
17
18 dfsSerialize(root, result);
19};
20
21const dfsSerialize = (node, result) => {
22 result.push(node.val);

Callers 2

serializeFunction · 0.85
dfsSerializeFunction · 0.85

Calls 2

dfsSerializeFunction · 0.85
pushMethod · 0.45

Tested by

no test coverage detected