Stack | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Stack

i need help with my code..i want to make a programme to take q queries and check if s equql to push then add x in the top of the stack ..if s equal to pop then remove the top of the stack..if s.equal to top then print the top of the stack . example: input 10 push 5 top push 6 pop push 3 top pop top pop top output 5 6 3 6 5

30th Aug 2020, 9:48 PM
sondos Toney
sondos Toney - avatar
2 Answers
+ 2
You need to try and post your tried code.. Or This may help you.. See... https://www.sololearn.com/learn/646/?ref=app
30th Aug 2020, 10:12 PM
Jayakrishna 🇮🇳
+ 2
Use the stl stack class which comes with methods like pop push and top so you don't have to atleast worry about writing all that from scratch
30th Aug 2020, 10:44 PM
Abhay
Abhay - avatar