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. Your task is to complete all the functions, using stack data-Structure.
Example 1:
Input:
Stack: 18 19 29 15 16
Output: 15
Explanation:
The minimum element of the stack is 15.
 
Your Task:
Since this is a function problem, you don't need to take inputs. You just have to complete 5 functions, push() which takes the stack and an integer x as input and pushes it into the stack; pop() which takes the stack as input and pops out the topmost element from the stack; isEmpty() which takes the stack as input and returns true/false depending upon whether the stack is empty or not; isFull() which takes the stack and the size of the stack as input and returns true/false depending upon whether the stack is full or not (depending upon the
given size); getMin() which takes the stack as input and returns the minimum element of the stack. 
Note: The output of the code will be the value returned by getMin() function.
Expected Time Complexity: O(N) for getMin, O(1) for remaining all 4 functions.
Expected Auxiliary Space: O(1) for all the 5 functions.
Constraints:
1 ≤ N ≤ 10^{4}

Source: geeksforgeeks | Difficulty: EASY
Tags: Data structures

Starter code: # Your task is to complete all these function's

# function should append an element on to the stack

def push(arr, ele):

    # Code here



# Function should pop an element from stack

def pop(arr):

    # Code here



# function should return 1/0 or True/False

def isFull(n, arr):

    # Code here



# function should return 1/0 or True/False

def isEmpty(arr):

    #Code here



# function should return minimum element from the stack

def getMin(n, arr):

    # Code here

Solutions:
def push(arr, ele):
	arr.append(ele)

def pop(arr):
	arr.pop()

def isFull(n, arr):
	if len(arr) >= n:
		return True
	return False

def isEmpty(arr):
	if len(arr) == 0:
		return True
	return False

def getMin(n, arr):
	return min(arr)


def push(arr, ele):
	arr.insert(0, ele)

def pop(arr):
	if arr == []:
		return -1

def isFull(n, arr):
	if len(arr) >= n:
		return True
	return False

def isEmpty(arr):
	if arr == []:
		return True
	else:
		return False

def getMin(n, arr):
	if arr == []:
		return -1
	else:
		return min(arr)


def push(arr, ele):
	arr.append(ele)

def pop(arr):
	if len(arr) == 0:
		return -1
	return arr.pop()

def isFull(n, arr):
	if len(arr) == n:
		return 1
	else:
		return 0

def isEmpty(arr):
	if len(arr) == 0:
		return 1
	else:
		return 0

def getMin(n, arr):
	return min(arr)


def push(arr, ele):
	arr.append(ele)

def pop(arr):
	return arr.pop()

def isFull(n, arr):
	return len(arr) == n

def isEmpty(arr):
	return len(arr) == 0

def getMin(n, arr):
	return min(arr)


def push(arr, ele):
	if not isFull(n, arr):
		arr.append(ele)

def pop(arr):
	if not isEmpty(arr):
		arr.pop()

def isFull(n, arr):
	if len(arr) == n:
		return 1
	else:
		return 0

def isEmpty(arr):
	if len(arr) == 0:
		return 1
	else:
		return 0

def getMin(n, arr):
	min = arr[0]
	for i in range(1, n):
		if min > arr[i]:
			min = arr[i]
	return min


def push(arr, ele):
	arr.append(ele)

def pop(arr):
	arr.pop()

def isFull(n, arr):
	return len(arr) == n

def isEmpty(arr):
	return len(arr) == 0

def getMin(n, arr):
	mini = float('inf')
	for ele in arr:
		mini = min(mini, ele)
	return mini


def push(arr, ele):
	arr.append(ele)

def pop(arr):
	return arr.pop()

def isFull(n, arr):
	if len(arr) == n:
		return 1
	return 0

def isEmpty(arr):
	if len(arr) == 0:
		return 1
	return 0

def getMin(n, arr):
	min = 1000000
	copy = []
	while len(arr) != 0:
		element = arr.pop()
		if element < min:
			min = element
		copy.append(element)
	return min


def push(arr, ele):
	arr.append(ele)

def pop(arr):
	elem = arr.top()
	arr.pop()
	return elem

def isFull(n, arr):
	return len(arr) == n

def isEmpty(arr):
	return len(arr) == 0

def getMin(n, arr):
	min_elem = 100000000
	while len(arr):
		min_elem = min(min_elem, arr[-1])
		arr.pop()
	return min_elem


def push(arr, ele):
	arr.append(ele)

def pop(arr):
	arr.pop()

def isFull(n, arr):
	if len(arr) == n:
		return True
	else:
		return False

def isEmpty(arr):
	if len(arr) == 0:
		return True
	else:
		return False

def getMin(n, arr):
	mini = arr[0]
	for i in range(1, n):
		if arr[i] < mini:
			mini = arr[i]
	return mini


def push(arr, ele):
	arr.append(ele)

def pop(arr):
	arr.pop()

def isFull(n, arr):
	return True if len(arr) == n else False

def isEmpty(arr):
	return True if arr == [] else False

def getMin(n, arr):
	dummyCopy = arr.copy()
	specialStack = []
	specialStack.append(dummyCopy.pop())
	while len(dummyCopy) >= 1:
		if specialStack[-1] < dummyCopy[-1]:
			dummyCopy.pop()
		else:
			specialStack.pop()
			specialStack.append(dummyCopy.pop())
	return specialStack[-1]


from collections import deque
st = deque()
ss = deque()

def push(arr, ele):
	st.append(ele)
	if len(ss) == 0 or ss[-1] >= ele:
		ss.append(ele)
	return

def pop(arr):
	if len(st) == 0:
		return -1
	ans = st.pop()
	if ss[-1] == ans:
		ss.pop()

def isFull(n, arr):
	return len(st) == n

def isEmpty(arr):
	return len(st) == 0

def getMin(n, arr):
	if len(ss) == 0:
		return -1
	return ss[-1]


def push(arr, ele):
	arr.append(ele)

def pop(arr):
	arr.pop()

def isFull(n, arr):
	if len(arr) == n:
		return True
	else:
		return False

def isEmpty(arr):
	if len(arr) == n:
		return False
	else:
		return True

def getMin(n, arr):
	m = arr[0]
	for i in arr:
		m = min(m, i)
	return m


def push(arr, ele):
	arr.append(ele)

def pop(arr):
	return arr.pop()

def isFull(n, arr):
	return len(arr) == n

def isEmpty(arr):
	return len(arr) == 0

def getMin(n, arr):
	min = float('inf')
	for i in range(len(arr)):
		if arr[i] < min:
			min = arr[i]
	return min


def push(arr, ele):
	arr.insert(0, ele)

def pop(arr):
	if arr != []:
		arr.pop(0)
	else:
		return

def isFull(n, arr):
	return len(arr) == n

def isEmpty(arr):
	return len(arr) == 0

def getMin(n, arr):
	if len(arr) != 0:
		return min(arr)


global mini
mini = float('inf')

def push(arr, ele):
	global mini
	if not arr:
		arr.append(ele)
		mini = ele
	else:
		x = ele
		if ele < mini:
			mini = ele
			data = 2 * ele - mini
			arr.append(data)
		else:
			arr.append(ele)

def pop(arr):
	global mini
	if arr:
		ele = arr.pop()
		if ele < mini:
			mini = 2 * mini - ele

def isFull(n, arr):
	return True if arr else False

def isEmpty(arr):
	return True if not arr else False

def getMin(n, arr):
	global mini
	return mini


import sys

def push(arr, ele):
	arr.append(ele)

def pop(arr):
	p = arr.pop()
	return p

def isFull(n, arr):
	if len(arr) == n:
		return True
	else:
		return False

def isEmpty(arr):
	if not arr:
		return True
	else:
		return False

def getMin(n, arr):
	mini = sys.maxsize
	while arr:
		mini = min(mini, arr[-1])
		arr.pop()
	return mini


def push(arr, ele):
	arr.append(ele)

def pop(arr):
	arr.pop()

def isFull(n, arr):
	return n == len(arr)

def isEmpty(arr):
	return len(arr) == 0

def getMin(n, arr):
	minn = 9999999
	for i in range(n):
		minn = min(minn, arr[i])
	return minn


def push(arr, ele):
	arr.append(ele)

def pop(arr):
	arr.pop()

def isFull(n, arr):
	if len(arr) == n:
		return 1
	return 0

def isEmpty(arr):
	if len(arr) == 0:
		return 1
	return 0

def getMin(n, arr):
	mini = 999999
	for i in arr:
		if mini > i:
			mini = i
	return mini


minele = 999

def push(arr, ele):
	global minele
	if len(arr) == 0:
		arr.append(ele)
		minele = ele
	elif ele >= minele:
		arr.append(ele)
	else:
		arr.append(2 * ele - minele)
		minele = ele

def pop(arr):
	global minele
	if len(arr) == 0:
		return -1
	else:
		cur = arr.pop(0)
		if cur > minele:
			return cur
		else:
			minele = 2 * minele - cur
			return minele

def isFull(n, arr):
	if n == len(arr):
		return True
	return False

def isEmpty(arr):
	if len(arr) == 0:
		return True
	return False

def getMin(n, arr):
	global minele
	return minele


top = None

def push(arr, ele):
	arr.append(ele)
	top = len(arr) - 1

def pop(arr):
	arr.pop()
	if arr == []:
		top = None
	else:
		top = len(arr) - 1

def isFull(n, arr):
	if top == len(arr):
		return True
	else:
		return False

def isEmpty(arr):
	if arr == []:
		return True
	else:
		return False

def getMin(n, arr):
	arr.sort()
	return arr[0]


def push(arr, ele):
	arr.append(ele)

def pop(arr):
	return arr.pop()

def isFull(n, arr):
	return 1 if n == len(arr) else 0

def isEmpty(arr):
	return 1 if not arr else 0

def getMin(n, arr):
	min_val = float('inf')
	for val in arr:
		min_val = min(min_val, val)
	return min_val


def push(arr, ele):
	stack.append(ele)

def pop(arr):
	if len(stack) == 0:
		return False
	else:
		stack.sort()
		stack.pop()

def isFull(n, arr):
	if len(stack) == n:
		return True
	else:
		return False

def isEmpty(arr):
	if len(stack) == 0:
		return True
	else:
		return False

def getMin(n, arr):
	stack.sort()
	a = stack[0]
	return a


def push(arr, ele):
	arr.append(ele)

def pop(arr):
	if not arr:
		return -1
	arr.pop()

def isFull(n, arr):
	n1 = len(arr)
	if n == n1:
		return True

def isEmpty(arr):
	if len(arr) == 0:
		return True

def getMin(n, arr):
	return min(arr)


def push(arr, ele):
	arr.append(ele)

def pop(arr):
	if arr:
		return arr.pop()

def isFull(n, arr):
	if len(arr):
		return True
	else:
		return False

def isEmpty(arr):
	if not arr:
		return True
	else:
		return False

def getMin(n, arr):
	return min(arr)


def push(arr, ele):
	arr.append(ele)

def pop(arr):
	if len(arr) != 0:
		elem = arr[-1]
		del arr[-1]
		return elem
	else:
		return -1

def isFull(n, arr):
	if len(arr) == n:
		return 1
	else:
		return 0

def isEmpty(arr):
	if len(arr) != n:
		return 1
	else:
		return 0

def getMin(n, arr):
	mini = 10 ** 5
	for i in range(n):
		if arr[i] < mini:
			mini = arr[i]
	return mini