Reversing stack Method 2 !! (One Helper Stack only)
#include <bits/stdc++.h> using namespace std ; stack < int > rev ( stack < int > s ) { int size = s . size (), x , y , t ; stack < int > s2 ; size -= 1 ; while ( size --) { t = size + 1 ; x = s . top (); s . pop (); while ( t --) { s2 . push ( s . top ()); s . pop (); } ...