Halloween Sale
Unlock all premium questions for over 30% off
Compress Nodes In N-ary Tree
Medium
Question
The input is an n-ary tree whose node values are all unique, together with a list compressedNodes. Every node named in that list must be compressed. To compress a node, delete it and hand its children to its parent: they take the deleted node's position among the parent's children, in their original order. compressedNodes never names the root. Return the root of the tree that results.
...
More Amazon interview questions
- Frequent Events Within 24 Hoursmedium
- Find Smallest Available Hubmedium
- Assemble String From Blocksmedium
- All String Reorganizationseasy
- Find Oldest One-Time Visitormedium
- Smallest Lexicographic Palindromemedium
- Connect Points In Unbounded Matrixhard
- Prefix Frequency Block Partitioneasy
OfferRetriever
Master technical interviews with real questions from top companies. Build your confidence and career.
LEGAL
© 2026 Purple Business Holdings LLC. All rights reserved. See Terms of Service.