ACTIVITY SELECTION POBLEM

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.

Input Format
The first line consists of an integer T, the number of test cases. For each test case, the first line consists of an integer N, the number of activities. Then the next N lines contain two integers m and n, the start and end time of each activity.

CAN YOU PLS MAKE ME UNDERSTAND WHAT IS THEPROBLM TRYING TO ASK BECAUSE IN THE OUTPUT IT IS RETURNING 0 AND 2ND I COULNT UNDERSTAND WHY??

hello @sneha23

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.

OK GOT IT
THANKYOU SO MUCH!!!

one more thing is it neccesary that i use pairclass will arrays only not work??

u need to use array of pairs,
two separate array will not work

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.