About the activity selection problem

could you plz help me as Im not able to do it

@aslesha.j7
hello aslesha,
pls refer this article -> https://www.geeksforgeeks.org/activity-selection-problem-greedy-algo-1/

Im sharing the link to my code. Could you plz tell me it is showing an error in the pair prev which I have made

@aslesha.j7
prev is not an array it is just a pair

so declare it somesthing like pair < int,int> prev;

still it shows one activity less for some test cases

@aslesha.j7
there is some issue with ur sorting
use inbuilt sort

thank you I got what the problem was.

but why is it not passing all the test cases

pls share ur updated code