Arista | OA | Server Network Construction | Minimum Spanning Tree (MST)

Question · Posted Apr 2026

Problem Statement: Server Network Construction The Objective: You are given n servers at various coordinates (xi​,yi​). You need to connect all servers such that every server is reachable from every other server (directly or indirectly) with the minimum total cost. The Cost Metric: The cost to connect server i and server j is defined as: Cost(i,j)=min(∣xi​−xj​∣,∣yi​−yj​∣) Example: Servers: (2,6),(4,10),(8,9) Cost(1, 2): min(∣2−4∣,∣6−10∣)=min(2,4)=2 Cost(2, 3): min(∣4−8∣,∣10−9∣)=min(4,1)=1 Total MST Cost: 2+1=3

The full answer & interview discussion are available to premium members.

Log in Create a free account