You are given a string S, the task is to reverse the string using stack.
You don't need to read input or print anything. Your task is to complete the function reverse() which takes the string S as an input parameter and returns the reversed string.
Expected Time Complexity: O(N)
Expected Auxiliary Space: O(N)
1 ≤ length of the string ≤ 100
We strongly recommend solving this problem on your own before viewing its editorial. Do you still
want to view the editorial?
Login to access your submissions.