Activity Selection Problem | Algorithm Interview | Skill-Lync Resources
Medium Algorithms Greedy Algorithms

Explain the activity selection problem and its greedy solution.

Answer

Given activities with start and finish times, select maximum non-overlapping activities. Greedy approach: sort by finish time, always select the activity that finishes earliest and is compatible with previous selection. This works because finishing early leaves maximum time for remaining activities. Time complexity is O(n log n) for sorting. This problem demonstrates when greedy gives optimal solution - can be proven by exchange argument.

Master These Concepts with IIT Certification
IIT Certified

Master These Concepts with IIT Certification

175+ hours of industry projects. Get placed at Bosch, Tata Motors, L&T and 500+ companies.

Relevant for Roles

Software Engineer Algorithm Developer Backend Developer