Can some one explain why the concept of using two stacks works and why popping an element in array2(containing minimum elements in order) only if it is same as in origignal array works?
i have a little understanding to why it works but cant understand it properly. Does some one have a mathematical formulation or aid me in understanding the concept.
:D
Thanks for reading. :D