Activity selectivity problem

my first test case is not passing second is passing

You need to sort ending times in ascending order and then pick the activities greedily.

can you how to use sort function in pairs i am not able to wrie syntax for ending time

oh my compare function was already correct what i haven’t done was that last variable k update to be in if block i maked it out of if block but now done thx btw