For this Question: An interviewer is asking you questions in form of queries. For your assistance, he has provided you with an empty array. Queries are of 4 types:-

(1 X) Add given element X to end of the array
(2 X) Delete the first instance of given element X from the array(if element is not present print -1)
(3)     Return maximum element of the array.
(4)     Return minimum element of the array.

See example for more clarificationThe first line contains an integer Q.
The next Q lines will each contain a query as mentioned above:- 

Constraints:
1 <= Q <= 100000
1 <= X <= 100000For queries 3 and 4, print the answer in a new line. If the array is empty for query 2, 3 or 4, then print "-1" without the quotes.Sample Input:-
6
1 5
1 9
1 1
3
2 1
2 1

Sample Output:-
9
-1

There are 5 queries.
Query 1 -> 5 is added to the array.
Query 2 -> 9 is added to the array.
Query 3 -> 1 is added to the array.
Query 4 -> The maximum element in the array is 9.
Query 5 -> The element 1 is deleted from the array.
Query 6 -> Since there is no element in the array with value 1, so the output is -1., I have written this Solution Code: import java.io.*;
import java.util.*;



class Main {
	public static void main (String[] args) throws IOException {
		BufferedReader br =new BufferedReader(new InputStreamReader(System.in));
		ArrayList<Integer> al =new ArrayList<>();
		int n=Integer.parseInt(br.readLine());
		for(int i=0;i<n;i++)
		{
			String s=br.readLine();
			if(s.charAt(0)=='1')
				al.add(Integer.parseInt(s.substring(2)));
			else if(s.charAt(0)=='2')
			{
				int b=Integer.parseInt(s.substring(2));
				if(al.contains(Integer.valueOf(b)))
					al.remove(Integer.valueOf(b));
				else
					System.out.println("-1");
			}
			else if(s.charAt(0)=='3')
			{
				if(al.size()>0)
				System.out.println(Collections.max(al));
				else
					System.out.println("-1");
			}
			else
			{
				if(al.size()>0)
					System.out.println(Collections.min(al));
				else
					System.out.println("-1");
			}
		}

	}
}, In this Programming Language: Java, Now tell me if this Code is compilable or not?