Search
⌘K

Leetcode 1135. Connecting Cities With Minimum Cost

Given n cities and a list of undirected weighted connections, find the minimum total cost to connect all cities (or return -1 if it's impossible). The core challenge is computing a minimum spanning tree (MST), typically solved with Kruskal/Prim and union-find to ensure full connectivity.

Asked at:

LinkedIn

LinkedIn

Meta


Question Timeline

See when this question was last asked and where, including any notes left by other candidates.

Mid April, 2026

LinkedIn

LinkedIn

Senior

Early April, 2026

LinkedIn

LinkedIn

Mid-level

Late May, 2025

Meta

Senior

Your account is free and you can post anonymously if you choose.