← Quant playground

Free practice library

Interview practice

Solve complete questions with progressive hints, worked solutions and Python implementations. Each question explains its assumptions and source match. Original interpretations are labelled explicitly.

752

Ready to practise

174

Not yet playable

926

Catalogue titles

Public standard problems and original exercises; hidden Trading Interview questions have not been verified.

174 titles have been investigated but remain unresolved. Their missing details are recorded without adding substitute exercises. Every playable question has a guided animated answer; selected questions also have custom diagrams.

Practise Learnr’s own questions →Follow a role-specific curriculum →

752 matching entries · page 1 of 16

Programming · Hard

Minimum Spanning Tree (MST)

Supported standard problem · Match confidence: high

Company use unverified
About this question’s source match

The title and Programming / Graphs classification fit the linked public problem. This entry uses an independently worded practice statement and original implementation. The public title and category identify a standard problem family; the private Trading Interview statement has not been inspected.

Implement solve(n,edges) returning the minimum total weight of a spanning tree, or None if the undirected graph is disconnected. Each edge is [u,v,weight]; vertices are 0 through n-1. Define the answer for n=0 or n=1 as zero.

Assumptions and constraints

  • Weights are integers and may be negative.
  • Parallel edges and self-loops are allowed.
  • 0 <= n <= 100000; <= 500000 edges

Examples

n=3, edges=[[0,1,4],[1,2,1],[0,2,7]]
→ 5

Selecting weights 4 and 1 connects every vertex without a cycle.

Company evidence · unverified

No company-specific source has been matched to this exercise. Its references support the topic or solution method; they do not establish employer use.

References

Read the supporting material without leaving your question.

Catalogue metadata captured 2026-10-12. Metadata source.