Maximumactivity selection problem


what is the problem with this code
it is not passing the test case

Hello @manthansrivastav1234 please wait i am checking your code .

Hello @manthansrivastav1234 i have corrected your code and it is passing all the test cases.


if you have any doubt you can ask here:
Happy Learning!!

i dont get what is the problem with my code

???i want to know what i am doing wrong in my code

@manthansrivastav1234 there are 3-4 mistakes like :
1.ans variable in which you are counting the number of activities you have to initialise it with 1because even all the activites are not overlapping then also you need 1 hall to manage all.
2.the if cindition in your loop in that you have to check if the first is greater then secind i.e if the start time is greater thenn the end time.
and also in that if you ecounter that condition then you have to check and manage one more variable for the previous meeting which is still in running.
now see your orginal code and the code which i have edited.
if you still have any doubt you can ask here:
Happy Learning!!

ok i got that thanks

@manthansrivastav1234 you can mark this doubt as resolved now.
Happy Learning!!