Help in KFIB

My code :

Share your code or submission link

you should give the question link , your solution link with your question. helps other to answer easily.

Refer for solution.

You may get negative answers. -5\%3 computes as -2, but what you want is 1.

i solved it with a simple calculation using queue
if you want you can refer to my code-