How to solve this

i didn’t understand that how to go for the answer

Hey @ashish_arora369
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

Hey @ashish_arora369
If u dont have any other doubt in this then please mark it as resolved :slight_smile:

Here see this for reference if required : https://ide.codingblocks.com/s/354844:slight_smile:

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.