← Snapdeal questions

Construct Tree from Parent Array representation

Filed under Snapdeal

Given an array 'parent' of size N where parent[i] is the parent of node i, and -1 indicates the root, construct the binary or general tree representation.

You've read your 3 free write-ups

Sign up free to keep reading. Your account opens the first 10 questions of every company.

Related Snapdeal questions

Collected from public candidate posts and coding forums. Updated Nov 2026.