Java create your own stack with a method which will always return the smallest number of the stack.

This question was asked in Apptio  Interview in the coder pad.

Q.Create an Integer Stack where you have push, pop, peek method also creates a method that will always return the smallest element of the stack.



Here we have used an integer array to implement it having methods push, pop and peek .
Previous
Next Post »

Pages