here i tried to form a array of pairs . each pair contaiing the start and the end times. then i sorted the array (according to the start times) and then found the maximum amount of
activities that can be done.
this code is not passing the test cases can someone correct this code?
Test cases not passing
Hello @ashishxmathew you should sort with their ending time.
if you will sort with their ending time then you have to check if the starting time of the next activity is greater then the ending time of the currect activity then you have to increment your variable by 1.
@ashishxmathew this is the correct code:
if you have any doubt you can ask here:
Happy Learning!!
1 Like