For this Question: You have an empty sequence A. Along with that you are given an array B of size N. You create a new integer i = 0 and perform N operations on the sequence A in the following way:
<ul>
<li>Check if i == N + 1, break. </li>
<li>Append B<sub>i</sub> to the end of A and increment i by 1. </li>
<li>Reverse the sequence A. </li>
Find the sequence A after all the operations.The first line of the input contains a single integer N.
The second line of the input contains N space seperated integers.

Constraints:
1 <= N <= 10<sup>5</sup>
1 <= B<sub>i</sub> <= 10<sup>9</sup>Print the sequence A after all the operations.Sample Input:
4
1 2 3 4

Sample Output:
4 2 1 3, 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));
        int n = Integer.parseInt(br.readLine());
        Deque<Integer> dq = new LinkedList<>();
        boolean flag = true;
        String[] str = br.readLine().split(" ");
        for(int i = 0; i < n; ++i)
        {
            if(flag) {
                dq.addFirst(Integer.parseInt(str[i]));
                flag = false;
            } else {
                dq.addLast(Integer.parseInt(str[i]));
                flag = true;
            }
        }
        if(flag) {
            while(!dq.isEmpty()) System.out.print(dq.pollLast()+" ");
        } else {
            while(!dq.isEmpty()) System.out.print(dq.pollFirst()+" ");
        }
    }
}, In this Programming Language: Java, Now tell me if this Code is compilable or not?