# Number of Provinces Soft **Idea.** DFS count components. **Complexity.** State time and space before coding. **Interview tip.** Restate constraints, give brute force first, then optimize. *Disclosure: practice note shared by the Linkjob AI team.* For live mock-interview practice see [Linkjob AI copilot](https://www.linkjob.ai/).