The given test case expects an answer of 1 for a fully connected network which obviously needs 0 satellites.
- Assuming that “With just one satellite, a planet can connect with any number of other planets.” means that if we have two unconnected components we will need a satellite on one of them only, then the number of satellites shall be equal to (number of connected components - 1) except for the case where the number of connected components = 0, that is there is no network at all so the number shall be 0 not -1 of course.
- Assuming that “With just one satellite, a planet can connect with any number of other planets.” means that if we have two unconnected components we will need a satellite on each of them , then the number of satellites shall be equal to (number of connected components) except for the case where the number of connected components = 1, that is there is one already fully connected network so the number shall be 0 not 1 of course.
