Hoodies At Coding Block

My code passing 8 test cases but giving TLE in 2 test cases can you suggest any updating or technique such that it will work

My code : https://ide.codingblocks.com/s/677239

hi @akshatjain4545,
Hint to Approach the problem:
step:01: make four queues for four courses and make one another queue that store the ordering of these four queues according to occurence.
step:02: Now take the inputs and make the cases based on course and rollno.

Now first try to solve it on your own…
I provide you the Reference code also, you can dry run it…

Reference Code:

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.

@talhashamim001 thanks