there family tree root 0 consist n node number 0 n 1 you give 0indexed integer array parent parentsi parent node since node 0 root parents0 1There 105 genetic value represent integer inclusive range 1 105 you give 0indexed integer array num numsi distinct genetic value node iReturn array an length n ansi small genetic value miss subtree root node iThe subtree root node x contain node x descendant node Example 1input parent 1002 num 1234output 5111explanation the answer subtree calculate follow 0 the subtree contain node 0123 value 1234 5 small miss value 1 the subtree contain node 1 value 2 1 small miss value 2 the subtree contain node 23 value 34 1 small miss value 3 the subtree contain node 3 value 4 1 small miss valueexample 2input parent 101033 num 546213output 711421explanation the answer subtree calculate follow 0 the subtree contain node 012345 value 546213 7 small miss value 1 the subtree contain node 12 value 46 1 small miss value 2 the subtree contain node 2 value 6 1 small miss value 3 the subtree contain node 345 value 213 4 small miss value 4 the subtree contain node 4 value 1 2 small miss value 5 the subtree contain node 5 value 3 1 small miss valueexample 3input parent 1230241 num 2345678output 1111111explanation the value 1 miss subtree Constraintsn parentslength numslength2 n 1050 parentsi n 1 0parents0 1parents represent valid tree1 numsi 105each numsi distinct