Max number of activities(STL)

Can you tell me what’s wrong with my code.
It giving the right answers for the sample test case but it is not being accepted

hello @rahul.gupta03111999

please share ur code using cb ide

are u getting tle?

dont use this ( as this is take too much time) ,
image

instead use sort function.

ur updated code->

Sir,in the updated code you have sorted the list with respect to the the second element in the pair.Can you please tell me where will it fail if I sort it with respect to the first element?

consider these activities->
1 10
2 3
3 4
4 5
5 6

and run ur algorithm

I got it Sir.Thank you for your help.