Stack designer
Submissions: 2734   Accuracy:


  Difficulty: Basic   Marks: 1
Associated Course(s):   Fork CPP

We are nearing the end of this course. We hope you've practiced additional questions too. This module is all about Stacks and Queues.

You are given an array A of size N. You need to push the elements of the array into a stack and then print them while popping.

Input Format:
The first line of input contains T denoting the number of testcases. T testcases follow. Each testcase contains two lines of input. The first line of input contains size of array N. The second line of array contains the elements of array separated by spaces.

Output Format:
For each testcase, in a new line, print the required output.

Your Task:
Since this is a function problem, you don't need to take any input. Just complete the provided functions _push() and _pop().

1 <= T <= 100
1 <= Ai <= 107


1 2 3 4 5
1 6 43 1 2 0 5
5 4 3 2 1
5 0 2 1 43 6 1

** For More Input/Output Examples Use 'Expected Output' option **

Author: Soul_xhacker

If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.

Need help with your code? Please use, generate link and share the link here.

to report an issue on this page.