1/14
Loading...
🏝️Connect Islands!
We need to connect 5 islands with bridges. Connect all islands with minimum cost!
Loading...
We need to connect 5 islands with bridges. Connect all islands with minimum cost!
There are n islands. Bridges can be built between islands, each with a different cost. Find the minimum cost to connect all islands.
5, [[0,1,5], [0,2,3], [1,2,2], [1,3,6], [2,3,4], [2,4,7], [3,4,3]]
12
Cost 2(1-2) + cost 3(0-2) + cost 4(2-3) + cost 3(3-4) = 12