DP World Interview Question

Connect n ropes with minimum cost