For this Question: Given a stack of integers and N queries. Your task is to perform these operations:-
<b>push:- </b>this operation will add an element to your current stack.
<b>pop:- </b>remove the element that is on top
<b>top:- </b>print the element which is currently on top of stack
<b>getMin:- </b> print the minimum element from the stack

<b>Note:- </b>if stack is already empty than pop operation will do nothing,-1 will printed as minimum element and 0 will be printed as a top element of stack if it is empty.<b>User task:</b>
Since this will be a functional problem, you don't have to take input. You just have to complete the functions:
 <b>push()</b>:- that takes the stack and the integer to be added as a parameter.
 <b>pop()</b>:- that takes the stack as parameter.
 <b>top()</b> :- that takes the stack as parameter.
 <b>getMin()</b> that takes the stack as parameter.

<b>Constraints:</b>
1 <= N <= 500000You don't need to print anything else other than in the <b>getMin()</b> function in which you need to print the minimum element of the stack, or -1 if the stack is empty and in the <b>top()</b> function in which need to print the top most element of your stack or 0 if the stack is empty.

<b>Note</b>:- Each output is to be printed in a new line.Sample Input:-
6
push 3
push 5
getMin
top
pop
top

Sample Output:-
3
5
3, I have written this Solution Code: 
 static Integer minEle; 
public static void push (Stack < Integer > s, int x) 
  {
    
   if (s.isEmpty()) 
        { 
            minEle = x; 
            s.push(x); 
           
            return; 
        } 
  
        // If new number is less than original minEle 
        if (x < minEle) 
        { 
            s.push(2*x - minEle); 
            minEle = x; 
        } 
  
        else
            s.push(x); 
    
  
} 
 
    // Function to pop element from stack
  public static void pop (Stack < Integer > s) 
  {
    
if (s.isEmpty()) 
        { 
            return; 
        } 
  
        
        Integer t = s.pop(); 
  
        // Minimum will change as the minimum element 
        // of the stack is being removed. 
        if (t < minEle) 
        { 
            
            minEle = 2*minEle - t; 
        } 
  
         
  
} 
 
    // Function to return top of stack
  public static void top(Stack < Integer > s) 
  {
    
if (s.isEmpty()) 
        { 
            System.out.println("0"); 
            return; 
        } 
  
        Integer t = s.peek(); // Top element. 
  
        // If t < minEle means minEle stores 
        // value of t. 
        if (t < minEle) 
            System.out.println(minEle); 
        else
            System.out.println(t); 
  
}
public static void getMin(Stack<Integer> s)
{
     if (s.isEmpty()) 
            System.out.println(-1); 
  
        // variable minEle stores the minimum element 
        // in the stack. 
        else
            System.out.println(minEle); 
}
  
 
, In this Programming Language: Java, Now tell me if this Code is compilable or not?