Given a stack with push(), pop(), empty() operations, delete middle of it without using any additional data structure.
The first line contains an integer T, the number of test cases. For each test case, the first line contains an integer sizeOfStack denoting the stack size. Next line contains space separated integers that will be pushed into the stack.
For each test case, in a new line, print the stack elements. If stack size if 1 then just print the top element.
This is a function problem. The input is already taken by the driver code. You only need to complete the function deleteMid() that returns the modified stack.
1 <= T <= 100
1 <= sizeOfStack <= 100
1 2 3 4 5
1 2 3 4 5 6 7
5 4 2 1
7 6 5 3 2 1
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.