I am not getting the aproach …
what I am trying is greedy …
if temple cost is less than road cost then I return (templeCost*n)
else I perform bfs for each component and count the total roads assuming one temple per component …
Now i m not getting that is it must for a greedy aproach that there needs to be only one temple per component or there can more than one temple …
assuming that we have only one temple … then … that temple is needed to be constructed on which city ? … I thought that it should be on one with max roads emerging from it(basically indegree).
got tle