Solving Recover a Tree From Preorder Traversal in go. Please try yourself first to solve the problem and submit your implementation to LeetCode before looking into solution.

Problem Description

If a node has only one child, that child is guaranteed to be the left child.

Example 1:

Input: "1-2--3--4-5--6--7"
Output: [1,2,5,3,4,6,7]

Example 2:

Input: "1-2--3---4-5--6---7"
Output: [1,2,5,3,null,6,null,4,null,7]

Example 3:

Input: "1-401--349---90--88"
Output: [1,401,null,349,88,90]

Note:

See the full details of the problem Recover a Tree From Preorder Traversal at LeetCode

Originally posted at: @github.com/halfrost/LeetCode-Go