For this Question: You are given an array <b>prices</b> where <b>prices[i]</b> is the price of a given stock on the i<sup>th</sup> day.

You want to maximize your profit by choosing a single day to buy one stock and choosing a different day in the future to sell that stock.

Print the maximum profit you can achieve from this transaction. If you cannot achieve any profit, return 0.First line contains n, denoting the number of days for transaction.
Next line contains n space separated integers denoting price on each day.

<b>Constraints</b>
1 <= n <= 10<sup>5</sup>
0 <= prices[i] <= 10<sup>9</sup>A single integer denoting the maximum profit.Input:
6
7 1 5 3 6 4

Output:
5

Explanation :
buy on 2nd day and sell on 5th day.
profit = sell - buy = 6 - 1 = 5, I have written this Solution Code: import java.io.*;
import java.util.*;


public class Main {
     
   
    
    public static void main(String[] args) {
        
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        OutputWriter out = new OutputWriter(outputStream);
        
        int n=Integer.parseInt(in.next());
        int a[] = new int[n];
        
        for(int i=0;i<n;i++){
            a[i] = Integer.parseInt(in.next());
        }
        
        int ans=0;
        int mn=a[0];
        for(int i=1;i<n;i++){
            int sell=a[i] - mn;
            ans=Math.max(ans,sell);
            mn=Math.min(mn,a[i]);
        }
        
        out.print(ans);
        out.close();
    }

    
    static class InputReader {
        BufferedReader reader;
        StringTokenizer tokenizer;
        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

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

    }

    static class OutputWriter {
        private final PrintWriter writer;

        public OutputWriter(OutputStream outputStream) {
            writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
        }

        public OutputWriter(Writer writer) {
            this.writer = new PrintWriter(writer);
        }

        public void print(Object... objects) {
            for (int i = 0; i < objects.length; i++) {
                if (i != 0) {
                    writer.print(' ');
                }
                writer.print(objects[i]);
            }
        }

        public void println(Object... objects) {
            print(objects);
            writer.println();
        }

        public void close() {
            writer.close();
        }

        public void println(int i) {
            writer.println(i);
        }

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