leetcode-894-All Possible Full Binary Trees

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/zem_nezer/article/details/86608930

we should know that it is not a normal pattern problem, we cannot traverse to solve the problem. Since we need to go it in linear…(I do not know how to describe). We assume that solve(X) is the list of all possible tree, then from the N node, we have left subtree with i node and right subtree with n - i - 1 node and 1 node of root, so we just combine root->left = slove(left) and root->right = slove(right) then finish the question.

Error:

  1. go to wrong path, it cannot use normal pattern to solve

猜你喜欢

转载自blog.csdn.net/zem_nezer/article/details/86608930