Delete Middle Element of a Stack
Medium

Problem Statement

Given a stack, delete the middle element of it without using any additional data structure.

Examples

1Example 1
Input:
{ "stack": [ 1, 2, 3, 4, 5 ] }
Output:
[ 1, 2, 4, 5 ]
2Example 2
Input:
{ "stack": [ 1, 2, 3, 4 ] }
Output:
[ 1, 2, 4 ]
3Example 3
Input:
{ "stack": [ 1 ] }
Output:
[]
Loading...

Sign in to Run Code and Submit