Coding Challenge

Serialize and Deserialize Binary Tree

Hard
treedesignbfsdfs

Convert a binary tree to a string and back.

Design methods to serialize a binary tree into a string and deserialize it back into the original structure.

Examples

Input: root = [1,2,3,null,null,4,5]

Output: restored original tree

Constraints

  • Preserve null positions

Preparing your coding workspace...