Design a stack with operations push(), pop(), getMiddle() and deleteMiddle()
10915

Implement a stack which will support following operations in O(1) time complexity.

  1. push() which adds an element to the top of stack.
  2. pop() which removes an element from top of stack.
  3. findMiddle() which will return middle element of the stack.
  4. deleteMiddle() which will delete the middle element.
    Push and pop are standard stack operations.
Comments (5)