Understand the problem
Restate the problem precisely. Interviewers reward candidates who pause, define the contract, and name the guarantees before coding.
A tree is an undirected graph in which any two vertices are connected by exactly one path. In other words, any connected graph without simple cycles is a tree. Given a tree of `n` nodes labeled from `0` to `n - 1`, and an array of `n - 1` `edges` where `edges[i] = [aᵢ, bᵢ]` indicates that there is an undirected edge between nodes `aᵢ` and `bᵢ`, you can choose any node of the tree as the root. When you select a node `x` as the root, the result tree has height `h`. Among all possible rooted trees, those with minimum height are called *minimum height trees* (MHTs). Return a list of all MHTs' root labels. You can return the answer in any order.
Once you've drafted a response, click Submit for AI review and a senior engineer will critique your reasoning.