i have seen the solution there they have sorted it and then reversed it why did they even did the reverse thing i didnt get that
Whats wrong with my implementatoin none test caes passing
only single test case passing throwing TLE
hey @chemant077
This question can be solved greedily by finding Maximum Spanning Tree, MST(which can be found using minimum spanning tree algorithms). For the graph to remain connected, leave the edges of the MST. Now sort the remaining edges in the increasing order of their cost, remove the edges until the sum of costs of removed edges doesn’t exceed the allowed total cost, s.