Showing:
Handle Score
@Ibrahim Nash 6420
@mb1973 5646
@Quandray 5233
@akhayrutdinov 5111
@saiujwal13083 4716
@sanjay05 3762
@kirtidee18 3673
@marius_valentin_dragoi 3522
@sushant_a 3459
@verma_ji 3413
Delete middle element of a stack
Easy Accuracy: 50.06% Submissions: 23273 Points: 2

Given a stack with push(), pop(), empty() operations, delete the middle of the stack without using any additional data structure.
Middle: ceil(size_of_stack/2.0)

Example 1:

Input:
Stack = {1, 2, 3, 4, 5}
Output:
ModifiedStack = {1, 2, 4, 5}
Explanation:
As the number of elements is 5 ,
hence the middle element will be the 3rd
element which is deleted



Example 2:

Input:
Stack = {1 2 3 4}
Output:
ModifiedStack = {1 3 4}
Explanation:
As the number of elements is 4 ,
hence the middle element will be the 2nd
â€‹element which is deleted

You don't need to read input or print anything. Complete the function deleteMid() which takes the stack and its size as input parameters and modifies the stack in-place.
Note: The output shows the stack from top to bottom.

Expected Time Complexity: O(N)
Expected Auxiliary Space: O(N)

Constraints:
2 <= size of stack <= 100