Amazon Interview QuestionSoftware Engineer / Developers
- 0of 0 votes
Create the n-ary tree from the ancestor matrix.
matrix[i][j]=1 if i is the ancestor of j.
find the root (row with all zeroes).
Set the column with a[i][root] =0
find all the rows with all zeroes.insert into the tree all the children.and push all into the queue.
pop and find the children ,insert into the tree with popped node as parent and push into the queue.
Can not implement properly as it needed some modifications.
This is asked from my friend at amazon bangalore.
Interview Type: In-Person