Explanation for the question(with picture)
Here are some hints I got from the example:\n1. If num 1 does not contain in the chidren nodes, the answer(genetic value) must be 1\n2. If we have a parent Node
Here are some hints I got from the example:\n1. If num `1` does not contain in the chidren nodes, the answer(genetic value) must be 1\n2. If we have a parent Node `p` has child Nodes :  `c1, c2, c3`  ,  here is the relation expression between their ans:\n  ```\n  answer[parent] >= max{answer[c1], answer[c2], answer[c3] }\n  ```\n  \n\n### solution\n\n1. init all answer as 1\n2. check smallest genetic value from the children(with value 1) to the parent. If there is no such a node, than the answer will be all 1 vector.\n\nhere is the picture explanation for detail:\nvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv\n[sample.pdf](https://github.com/ukohank517/coder/files/7149169/sample.pdf)\n\n\n\n### sample code(cpp, with explaination)\n\ncomplexity: O(N)\n\n```\nclass Solution {\npublic:\n    vector<int> smallestMissingValueSubtree(vector<int>& parents, vector<int>& nums) {\n\t    // make a graph\n        vector<vector<int> > G(parents.size() + 1, vector<int>(0));\n        for(int i = 0; i < parents.size(); i ++){\n            if(parents[i] == -1) continue;\n            G[parents[i]].push_back(i);\n        }\n\n\t\t\n        map<int, bool> visited; // dont\'t need to check the route that we come up with\n        map<int, bool> has_num_in_children;\n\n        // all answer should be init by 1\n        vector<int> ans(nums.size(), 1L);\n\n        // the node we now place, and it\'s answer\n        int now = 0;\n        int now_ans = 1;\n        for(int i = 0 ; i < nums.size(); i ++){\n            if(nums[i] == 1) {\n                now = i;\n                break;\n            }\n        }\n\n        // init\n        queue<int> q;\n\n        while(0 <= now and now < nums.size()){\n\t\t    // here use queue to traverse the other route\n            q.push(now);\n            visited[now] = true;\n            has_num_in_children[nums[now]] = true;\n            while(q.size() != 0){\n                int tp = q.front();\n                q.pop();\n                for(int i = 0; i < G[tp].size(); i++){\n                    int nxt = G[tp][i];\n                    if(visited[nxt]) continue;\n                    visited[nxt] = true;\n                    has_num_in_children[nums[nxt]] = true;\n                    q.push(nxt);\n                }\n            }\n\t\t\t\n\t\t\t// set answer\n\t\t\t// since the answer will only increase\n            while(true){\n                if(!has_num_in_children[now_ans]) break;\n                now_ans ++;\n            }\n            ans[now] = now_ans;\n            now = parents[now];            \n        }\n\n        return ans;\n    }\n};\n\n```
[]