Amazon Interview Question

Hard leetcode question on making a tree with two arrays given parent and their children.