Activity selection problem

can you provide hint for this?

Hey @shubhangis248
In this problem u will be given n activites whose start and end time is given.
now the task is u need to tell what is the maximum number of activites u can perform (constraint is that u cannot do two overlapping activites together)
for example->
image

here u have 3 activities.
if u pick 1st (10-20) then u cannot pick 2nd becuase its time overlap.
best choice is to pick 1st and 3rd becuase they are not overlapping .
hence answer will be 2.

Correct approach is this:
A basic activity selection problem which uses Greedy approach. The implementation mentioned here states to sort the activities in the increasing order of their finishing times. Initially, we choose the first activity. Now, starting from second activity, current activity can be selected if the finish time of previous selected activity is less than or equal to the starting time of current activity


it is showing segmentation fault

Hey @shubhangis248
Its working perfectly fine on my side


Pleaes check again :slight_smile: