Search
⌘K

Leetcode 894. All Possible Full Binary Trees

Generate all structurally unique full binary trees with n nodes (each node has 0 or 2 children and Node.val == 0). Only odd n can produce solutions, so the task reduces to combinatorially partitioning the remaining nodes between left and right subtrees and combining all valid subtree pairs.


Question Timeline

See when this question was last asked and where, including any notes left by other candidates.

Comments

Your account is free and you can post anonymously if you choose.