record: for each node there are as many dashes - as its depth, immediately followed by its value. The root has depth 0, and a child is one level deeper than its parent.
If a node has only one child, that child is always the left one.
Rebuild the tree from record and return its root.record="7-3--8-9" → [7, 3, 9, 8]
The root is 7 (no dashes). It has two children with one dash, 3 and 9; 3 has a single child 8, which is its left child.
record="12-5--40---6" → [12, 5, None, 40, None, 6]
Each value is one level deeper than the previous, so the tree is a chain of left children.
record="4" → [4]
record is a valid record of such a treerecord="7-3--8-9"
[7, 3, 9, 8]
Run checks the first 3 tests in your browser. Submit checks all 30 tests on the server, hidden ones included.