Design an algorithm to serialize and deserialize a binary tree. Serialization is the process of converting a data structure into a sequence of bits so that it can be stored. Deserialization is the reverse. There is no restriction on how your algorithm works.
- The
rootof a binary tree (for serialize) or a string (for deserialize).
Input: root = [1, 2, 3, null, null, 4, 5]
Output: [1, 2, 3, null, null, 4, 5] (after round trip)