Given a stack represented as an array (index 0 is the bottom, the last element is the top), return the stack reversed so that the old bottom becomes the top. The input is JSON {stack}.
Input: JSON {stack}.
Output: Array — the reversed stack (bottom to top).
Input: {"stack":[1,2,3,4]}
Output: [4,3,2,1]
Explanation: Top and bottom swap ends.Input: {"stack":[]}
Output: []
Explanation: Empty stays empty.Input: {"stack":[9]}
Output: [9]
Explanation: Single element unchanged.0<=n<=1000