Dynamic Queue alternate approach

I had done an approach in which instead of moving front element to 0th index.
I had inserted spaces before front.
(Please refer code)

When I run it, it’s working perfectly fine.

Is this approach valid?

Hi @vivek21,
No this approach will not be valid. It can give run time error in case of large test cases.

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.