Why using %N with rear and front increment pointer?

Why using %N with rear and front increment pointer?

Because you have to implement a circular queue.
Say array size is 4. If you want to mimic it as a circular array you will have to use %N
Say if last element in the array is at arr[3]. If you want to push an element in it… you will push it at index [(3+1)%4] which is arr[0]
Dry run yourself and check once

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.