Your question is Store an AVL Tree. Start with the requirements on the right.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.
How would you store an AVL tree?
Implement serialize_avl(root) to encode the tree structure using preorder traversal and None markers for missing children. The input is a nested list [key, left, right], or None for an empty tree. Return a flat list that preserves every key and child relationship, including the empty tree case.
def serialize_avl(root):