Let n is the no.of vertices
k is the components,
Minimum no.of edges = n - k
Maximum no.of edges = $\binom{n-k+1}{2}$
https://gateoverflow.in/237427/graph-theory
--------------------------------------------------------------
if k is the Minimum degree
Min. No.of edges = $⌈\frac{kn}{2}⌉$
if k is the Maximum degree
Max. No.of edges = $⌊\frac{kn}{2}⌋$
--------------------------------------------------------------
in the question, they given k is components, but in the answer they consider k is minimum degree