← Amazon questions

Duplicate each node as its leftmost child in generic tree

Filed under Amazon

Design an N-ary (generic) tree data structure where each node contains a value and a list of children. Write a function to modify the tree such that every node gets a duplicate of itself inserted as…

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 Amazon questions

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