What is start and end time means here

what is start and ed time how can be end time be 30

@anubhavb11 you need not stress on the what format the time is in, assume the time is represented by a linear scale.
so time all the time is like length segments starting, they can start from 1 and go till 100.
Suppose in the given example we can select 12 - 15, 20- 30 or we can select 10-20 , 20-30 (as there should be no overlap) (end point and start point can overlap)
If this resolves your doubt mark it as resolved.

so we can select 12-15 and 20-30 also?

i cant think of any solution can you please give me a hint

@anubhavb11 Yes we can select 12-15 and 20-30. First activity ends at 15 which is smaller then the starting time of second activity so we can select them.
To solve this problem, store the activities in an array of pair and then sort on the basis of end time, now select the first activity, and have one variable to record its end time, now compare its end time to next activity if it starts at time latter than the endtime update endtime with the endtime of this activity and increase the selected activity count else move forward.


If this resolves your doubt mark it as resolved.

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.