My code is running on sample input but all test cases are are not passing

My code is running on sample input but all test cases are are not passing.

Hello @updesh13 could you please share the hackerblocks link of this question?

I am not able to search it in hackeblocks. It is party hall problem same as leetcode meeting rooms 2

@updesh13 okay you can try any other questions till then i have asked the team to upload them in hackerblocks.
i will solve your doubt ASAP.
please wait.

…okay

Hello @updesh13 see this code:
Basically we have to compute the maximum number of active halls for the given start and end times on the basis of overlapping time periods.
1.Maintain two arrays namely start[ ] and end[ ] with start and end times by splitting the in[ ][ ] input array.
2.Sort the two arrays maintained in step1.
3.Initialize two variables i and j i.e start index and end index to 0.
4.Initialize two more variables c(Active party halls at instant) and max(maximum number of active halls needed) to 0. 5.If start[i] or start time < end[i] or end time, i.e we have overlapping time periods hence we have a party active. So increment c i.e active party halls and increment start index i.
6.Else time periods are not overlapping so decrement c and increment end index j.
7.Now compute the maximum between c and max to record the max number of active halls.
8.Return max.


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

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.