Pls revert back as soon as possible

i am not able to understand the problem pls tell me

hi @Madhavendra-Gupta-2240591552663161, problem statement is : -
You are given n activities (from 0 to n-1) with their start and finish times. Select the maximum number of activities that can be performed by a single person, assuming that a person can only work on a single activity at a time.

here since the person can only work on a single activity at a time thus he can;t do two activities that overlap with each other , i can better explain u with some examples

Example 1

3 //no of activities
10 20 // time intervals of activities (start time - end time)
12 15
20 30

here, ans=2,as the person can perform two activity
as the person can;t perform activity 1 and 2 together as if he chooses activity 1 then he will be busy from 10-20 so he can;t pick the activity that starts between the interval but he can choose activity 3 as it starts the same time activity 1 terminates. similarly he can choose activity 2 and 3

6
1 2
3 4
0 6
5 7
8 9
5 9

A person can perform at most four activities. The
maximum set of activities that can be executed
is acivity {1, 2, 4, 5}

In case of any doubt feel free to ask :slight_smile:
If you got the answer then mark your doubt as resolved

https://ide.codingblocks.com/s/214618 Sir i have written the code but it is not able to pass any of the test case pls revert back soon

hi @Madhavendra-Gupta-2240591552663161, sort the intervals based on finishing time as the input may not be sorted also, you don;t need to check for constraints , constraints are to tell us the range of values input can take so that we can devise our algo accordingly

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.