We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
With Python 3, I'm using Kruskal's algorithm to find the minimum spanning tree and then summing the edges as described by other posts here. This times out on test cases 11+, so I tried the Floyd-Warshall algorithm and that timed out even earlier. What can I do to optimize my solution enough to pass more cases?
Roads in HackerLand
You are viewing a single comment's thread. Return to all comments →
With Python 3, I'm using Kruskal's algorithm to find the minimum spanning tree and then summing the edges as described by other posts here. This times out on test cases 11+, so I tried the Floyd-Warshall algorithm and that timed out even earlier. What can I do to optimize my solution enough to pass more cases?