InterviewDB
Question
Efficient Cost: Minimize Total Cost to Connect All Nodes in a Network
Question Details
Problem You are given n nodes and a list of potential edges, each with a cost. Find the minimum total cost to connect all nodes (i.e., build a minimum spanning tree). If it is impossible to connect all nodes, return -1. Example: Approach Kruskal's with Union-Find: sort edges by cost, greedily add edges that don't form a cycle. Time: O(E log E). Follow-ups When would you prefer Prim's algorithm over Kruskal's? What if some nodes already have a free connection (cost = 0) — does the algorithm chang…
Full Details
🔒
Unlock all Snowflake questions
Full insider details, leaked discussions, and candidate experiences.
or every company, $100/year →About This Question
This is a reported interview question from a snowflake interview during the oa round.
It covers the following topics: System Design, Coding, Union Find, Oa .
Topics
More Snowflake Interview Questions
Reddit
Snowflake screening interviews coming up — system design + coding questions?
Reddit
Tips Systems Role Snowflake
1p3a
snowflake hr screen interview experience for software engineer role
1p3a
Snowflake 2026 Software Engineer Intern VO Interview Experience
1p3a
Snowflake SWE AI/ML Intern Online Assessment Problems