3 ms·If you allow twice the solution, you can do it in O(m log n) time using MST.by JohnKemeny 2mo agoIf you allow twice the solution, you can do it in O(m log n) time using MST.