medium - accepted / - tried
For example, for a tree from 91. invert a binary tree
BFE.dev would serialize it to
But there are more ways of doing it rather than above, any would be fine as long as your
serialize() work as a pair.
Your code is tested like this:
const tree1 = ... expect(typeof serialize(tree1)).toBe('string') const tree2 = deserialize(serialize(tree1)) expect(isIdentical(tree1, tree2)).toBe(true)
Binary tree in this problem consists of value of integers.