+ 1
How to compare the input and the Top of stack?
if top value < input value, then input value allowed get into the stack
2 ответов
+ 4
Use the "Peek" Method to get the value on top of the stack and compare using "if".
If input is greater use the "Push" method to add the value to the stack.
+ 1
thanks!!