C#: Connect N ropes with minimum cost

Level : Beginner
Mentor: Shailendra Chauhan
Type : GuidedLab
Points : 10
Duration : 00:15:00

Lab Details

Difficulty Level: MEDIUM

Problem Statement:

You are given N different length ropes. Write an efficient program to connect these ropes into one with minimum cost, such that the cost of connecting two ropes is equal to the sum of their lengths.

Input:

arr[] = { 4, 3, 2, 6 }, N=4

Output:

29


Self-paced Membership
  • 22+ Courses
  • 750+ Hands-On Labs
  • 200+ Quick Notes
  • 55+ Skill Tests
  • 45+ Interview Q&A
  • 10+ Real-world Projects
  • Career Coaching
  • Email Support
Upto 66% OFF
KNOW MORE..

To get full access to all courses

Still have some questions? Let's discuss.
CONTACT US
Accept cookies & close this