There are N
cities numbered from 1
to N
.
You are given connections, where each connections[i] = [city1, city2, cost]
represents the cost to connect city1
and city2together
.
(A connection is bidirectional
: connecting city1
and city2
is the same as connecting city2
and city1
.)
This is a companion discussion topic for the original entry at https://algo.monster/problems/min_cost_to_add_new_roads/