Implement a stack using an array. The stack should support the following operations:
push(value: int): Adds value to the top of the stack.pop(): Removes and returns the top value from the stack. If the stack is empty, return None.peek(): Returns the top value without removing it. If the stack is empty, return None.is_empty(): Returns True if the stack is empty, otherwise False.Example 1:
stack = MyStack()
stack.push(1)
stack.push(2)
stack.peek() # Output: 2
stack.pop() # Output: 2
stack.is_empty() # Output: False
Example 2:
stack = MyStack()
stack.pop() # Output: None
stack.peek() # Output: None
stack.is_empty() # Output: True
10^4 elements.[-10^9, 10^9].