TikTok Interview Question

Serialize and deserialize a tree