310. Minimum Height Trees

這題還是挺難的

關鍵是從leaf出發

indegree[edge[0]]++
indegree[edge[1]]++;

還要考慮這個問題

T: O(|V|)

S: O(|V|)

Last updated

Was this helpful?