Given a non-empty stack represented as an array (index 0 is the bottom), return the middle element, defined as the element at 0-indexed position n/2 (integer division) counting from the bottom. The input is JSON {stack}.
Input: JSON {stack}.
Output: Integer — the middle element.
Input: {"stack":[1,2,3,4,5]}
Output: 3
Explanation: Position 2 (0-indexed) of 5 elements.Input: {"stack":[10]}
Output: 10
Explanation: Single element is the middle.Input: {"stack":[1,2,3,4]}
Output: 3
Explanation: Position 2 of 4 elements.1<=n<=10^5