For this Question: After saving the planet of Xander in 2014 from Ronan, the guardians of the galaxy decided to play a game on it. Between the vast furious oceans, they discover a row of buildings. The buildings are of different heights arranged at each index along a number line. Gamora starts at building 0 and a height of 0. Groot gets the task to <b>determine the minimum thrust that Gamora needs at the start of the game so that she can jump to the top of each building without her thrust going below zero</b>. Write a code to help Groot with his task.
The units of height relate directly to units of thrust. Gamora’s thrust level is calculated as follows:
•	If gamora's thrust is less than the height of the building, her new thrust = gamora's thrust – (height – gamora's thrust)
•	If gamora's thrust is greater than equal to the height of the building, her new thrust = gamora's thrust + (gamora's thrust - height)The first line contains an integer n, the number of buildings.
The second line n space-separated integers, arr[1], arr[2]…arr[n], the heights of the building.

<b>Constraints:-</b>
1 &le; n &le; 10<sup>5</sup>
1 &le; arr[i] &le; 10<sup>5</sup>The output contains a single integer denoting the minimum thrust Gamora needs at the start of the game.Sample Input:-
5
3 4 3 2 4

Sample Output:-
4

Explanation:- 
If we take 3 then:-
at index 1:- 3 + 3-3 = 3
at index 2:- 3 - (4-3) = 2
at index 3:- 2 - (3-2) = 1
at index 4:- 1 - (2-1) = 0

Sample Input:-
3
4 4 4

Sample Output:-
4, I have written this Solution Code: import java.io.*;
import java.util.*;



class Main {
	public static void main (String[] args) {


        FastReader sc = new FastReader();
        int n = sc.nextInt();
        long[] arr = new long[n];
        for (int i = 0; i < n; i++) {
            arr[i]= sc.nextLong();
        }
        long l = 0;
        long r= 1000000000;
        long x=0;
        while (l!=r){
             x= (l+r)/2;
            if(checkThrust(arr,x)) {
                r=x;
            }
            else {
                l=x+1;
            }
        }
        System.out.print(l);
	}
	static boolean checkThrust(long[] arr,long r){
        long thrust = r;
        for (int i = 0; i < arr.length; i++) {
            thrust = 2*thrust-arr[i];
            if(thrust>=1000000000000L) return true;
            if(thrust<0) return false;
        }
        return true;
    }
    static class FastReader {
        BufferedReader br;
        StringTokenizer st;

        public FastReader()
        {
            br = new BufferedReader(
                    new InputStreamReader(System.in));
        }

        String next()
        {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                }
                catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() { return Integer.parseInt(next()); }

        long nextLong() { return Long.parseLong(next()); }

        double nextDouble()
        {
            return Double.parseDouble(next());
        }

        String nextLine()
        {
            String str = "";
            try {
                if(st.hasMoreTokens()){
                    str = st.nextToken("\n");
                }
                else{
                    str = br.readLine();
                }
            }
            catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
    }
}, In this Programming Language: Java, Now tell me if this Code is compilable or not?