Java Advanced/02 Basic Stack Operations
Колеги,
кода по-долу не минава теста в случая, когато броя на елементите, които трябва да се махнат е равен на броя на елементите в стака, а в условието не пише какво трябва да се направи в този случай.
You will be given an integer N representing the number of elements to push onto the stack, an integer S
representing the number of elements to pop from the stack and finally an integer X, an element that you should
check whether is present in the stack. If it is, print true on the console. If it’s not, print the smallest element
currently present in the stack.
Input:
On the first line, you will be given N, S and X separated by a single space.
On the next line, you will be given a line of numbers separated by one or more white spaces.
Output:
On a single line print either true if X is present in the stack otherwise print the smallest element in the stack.
If the stack is empty print 0.
http://pastebin.com/jZwxanut
https://judge.softuni.bg/Contests/Practice/Index/187#1