Whats wrong with my code?

hello @akash_281
check now->

Hey @aman212yadav I understood but can you tell what was wrong in this part of the code why its not working?

for(int i=0;i<n;i++)

    {

        s1.push(s2.top());

        s2.pop();

    }

@akash_281
we will not always have n elements in the s2 stack.
it will be less and counting will decrease in each iteration.
thats why i removed that loop.

1 Like