Activity selection problem doubt


i made a code and get 2 as output for sample input case
but testcases does nt pass pls correct and explain me where i am wrong asap

Hi Dipesh,
ur logic is not correct. 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.

refer this code --> https://ide.codingblocks.com/s/630532

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.