For this Question: You are given Q queries. Each query consists of a single number N. You can perform any of the 2 operations on N in each move:
1: If we take 2 integers a and b where N = a x b(a≠1, b≠1), then we can change N = max(a, b)
2: Decrease the value of N by 1.
Determine the minimum number of moves required to reduce the value of N to 0.The first line contains the integer Q. 
The next Q lines each contain an integer, N.

<b>Constraints</b>
1 ≤ Q ≤ 10<sup>3</sup>
1 ≤ N ≤ 10<sup>6</sup>Output Q lines. Each line containing the minimum number of moves required to reduce the value of N to 0.Sample Input 
2
3
4
Sample Output
3
3
Explanation
For test case 1, We only have one option that gives the minimum number of moves. 
Follow 3- >2- >1- >0. Hence, moves.
For the case 2, we can either go 4- >3- >2- >1- >0 or 4- >2- >1- >0. The 2nd option is more optimal. Hence, 3 moves., I have written this Solution Code: import java.io.*;
import java.util.*;



class Main {
	public static void main(String[] args) {
    	Scanner sc = new Scanner(System.in);
        solve(1000000);
        int t = sc.nextInt();
        for(int i=0; i<t; i++)
        System.out.println(table[sc.nextInt()]);
    }

	public static int[] table = new int[1000001];
    public static void solve(int n){
        for(int i=1; i<=n; i++)
        table[i] = n+1;
        ArrayDeque<Integer> q = new ArrayDeque<Integer>();
        q.add(0);
        while (!q.isEmpty()){
            int next = q.poll();
            if (next > 0)
            for (int i=Math.min(next, n/next); i > 0; i--){
                if (table[i*next] > table[next] + 1){
                    table[i*next] = table[next] + 1;
                    q.add(i*next);
                }
            }
        	if (next < n && table[next+1] > table[next]+1){
                table[next+1] = table[next] + 1;
                q.add(next+1);
            }
        }
    }
}, In this Programming Language: Java, Now tell me if this Code is compilable or not?