Recursion, binary trees.
You are given zero or a positive integer.
Convert it to binary and place it in a binary tree, then determine whether it forms a valid tree.
For example, 9 becomes 1001 in binary, producing the following tree.
This is
not a valid tree
.
In this problem, a 0 represents a missing node.
The following example converts 7 to binary and places it in a binary tree.
This is a
valid tree
because no child node has an empty parent node.
Return a list containing 1 for each valid tree and 0 otherwise.