Design and Implement Special Stack Data Structure
Design a Data Structure SpecialStack that supports all the stack operations like push(), pop(), isEmpty(), isFull() and an additional operation getMin() which should return minimum element from the SpecialStack. All these operations of SpecialStack must be O(1). To implement SpecialStack, you should only use standard Stack data structure and no other data structure like arrays, list, . etc.
Note: The output of the code will be the value returned by getMin() function.
Examples:
Input: [18, 19, 29, 15, 16]
Output: 15
Explanation: The minimum element of the stack is 15.Input: stack: [34, 335, 1814, 86]
Output: 34
Explanation: The minimum element of the stack is 34.
Please refer Design a stack that supports getMin() in O(1) time for three different approaches to solve this problem.