Clone a stack without usinig extra space
Gauravsharma-20 opened this issue · 3 comments
Gauravsharma-20 commented
Given elements of a stack, clone the stack without using extra space.
Example:
Input:
N = 10
st[] = {1, 1, 2, 2, 3, 4, 5, 5, 6, 7}
Output:
1
Your Task:
You don't need to read input or print anything. Your task is to complete the function clonestack() which takes the input stack st[], an empty stack cloned[], you have to clone the stack st into stack cloned.
The driver code itself prints 1 in the output if the stack st is cloned properly and prints 0 otherwise.
Expected Time Complexity: O(N*N)
Expected Auxiliary Space: O(1)
saaiiravi commented
I would like to work on this.
Gauravsharma-20 commented
Cool. I'll assign it to you.
saaiiravi commented
Hi,
Submitted PR for this issue. Please check.