Please help ,This pop question is killing me๐Ÿ˜ญ๐Ÿ˜ญ | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 4

Please help ,This pop question is killing me๐Ÿ˜ญ๐Ÿ˜ญ

even the code playground says "no output" but in challenges i face this question where there is no option of "no output" and there is no information in courses either๐Ÿ˜ต๐Ÿ˜ต๐Ÿ˜ต so please tell me how it works!! https://code.sololearn.com/cM2rt8Y3ph2L/?ref=app

27th May 2017, 11:27 AM
U L Knw Me soon๐Ÿ˜‰๐Ÿ˜‹
U L Knw Me soon๐Ÿ˜‰๐Ÿ˜‹ - avatar
8 Answers
+ 12
When pop is encounter first element is removed depending on whether it is front or not . else last element is removed.
27th May 2017, 12:02 PM
Prabhu Nithin
Prabhu Nithin - avatar
+ 11
it's actually 221
27th May 2017, 12:03 PM
Prabhu Nithin
Prabhu Nithin - avatar
+ 11
just read a bit it should be. 1. you create a deque 1, 2, 3 2. pop_front removes the first, so you have now 2, 3 in the deque. 3. You cout the front element, so output 2. 4. pop_back removes the last, so now it's only 2 in the deque. 5. Then cout back is 2 and cout size is 1. 6. Total output: 221
27th May 2017, 12:08 PM
Nikolay Nachev
Nikolay Nachev - avatar
+ 10
is 221 the correct answer?
27th May 2017, 12:02 PM
Nikolay Nachev
Nikolay Nachev - avatar
+ 6
still trying to figure out the no output part....
27th May 2017, 12:47 PM
Nikolay Nachev
Nikolay Nachev - avatar
+ 5
thanks @prabhu nd u r ri8 @ nikolay
27th May 2017, 12:04 PM
U L Knw Me soon๐Ÿ˜‰๐Ÿ˜‹
U L Knw Me soon๐Ÿ˜‰๐Ÿ˜‹ - avatar
+ 3
@ nikolay thanks again and do u know y code playground doesnt show the output๐Ÿ˜…
27th May 2017, 12:17 PM
U L Knw Me soon๐Ÿ˜‰๐Ÿ˜‹
U L Knw Me soon๐Ÿ˜‰๐Ÿ˜‹ - avatar
+ 2
i dont know @nikolay i have never got correct answer in this question even once๐Ÿ˜…
27th May 2017, 12:03 PM
U L Knw Me soon๐Ÿ˜‰๐Ÿ˜‹
U L Knw Me soon๐Ÿ˜‰๐Ÿ˜‹ - avatar