yahi kaam pair se bhi toh ho skta tha vector kyu liya ?
aur dono ways m kya difference hoga ??
aur kuch aisa h kya vector m size limit nhi dena hota jitna assign kiya utna print ho jayega ??
Prime_factor function m vector kyu liye?
@anujsharmabadboy in this question you have to store the no and the cnt (times which it divides)
so sir stored in vector of pairs. you can use array of pairs too no issue. yes in vector its not compulsory to define size thats why it is considered above array for its dynamic property
hope its clear if yes dont forget to hit like and mark resolved 
lekin sir ne toh for(auto p:factor) aur factor. krke likhvaya tha
bhai m doubt resolve krne ka try kr rha hu lekin option hi nhi aa rha