Infosys Interview Question

adding and removing element from stack