Unable to find the error

i am unable to find the error in this code though it looks correct to me.

@akshatkaush
Do not use deque constructor
deque q;

yeah, it is now giving correct answer but i did’nt understand what difference did it make

@akshatkaush
Say n is equal to 5. When you declared it as deque q(n), you get a deque as
0,0,0,0,0 i.e. with 5 zeroes.
Then you appended elements into it further. Say you push_back 4 ( randomly chosen ).
Your deque becomes
0,0,0,0,0,4
when you actually intended it to be just
4

ok, thank you so much!