package
0.0.0-20241220224003-b7cf03a90b2b
Repository: https://github.com/szhou12/leetcode-go.git
Documentation: pkg.go.dev
# README
444. Sequence Reconstruction
Solution idea
Topological Sort
要点总结
- When does Topological Sort gives uniquely sorted array?
- if there is
> 1
nodes at same level (degree == 0), then sorted array is NOT unique - 如何判别?
queue
每时每刻都只会有一个元素,每 pop 1个元素,它只会 enqueue 1个元素
- if there is
Time complexity = $O(V+E)$