For this Question: Given an integer N which is to be reduced to 1 by performing the given operation:-
In one operation you can subtract any divisor of N other than N itself from N. 
Your task is to find the minimum number to reduce N to 1.The input contains a single integer N.

<b>Constraints:-</b>
1 <= N <= 1000Print the minimum number of operations need to convert N to 1.Sample Input 1:-
5

Sample Output 1:-
3

<b>Explanation:-</b>
5 - > 4 - > 2 - > 1

Sample Input 2:-
8

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



class Main {
    static short min = 127;
    public static void main (String[] args)throws IOException {

        BufferedReader sc = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(sc.readLine());







        int[] dp = new int[n+1];
        Arrays.fill(dp, 1000);
        dp[0] = 0;
        dp[1] = 0;
        for(int i=2; i<=n; i++){
            for(int j=2; j*j <= i; j++){
                if(i%j == 0){
                    dp[i] = Math.min(dp[i], dp[i-j]+1);
                    dp[i] = Math.min(dp[i], dp[i-(i/j)]+1);
                }
            }
            dp[i] = Math.min(dp[i], dp[i-1]+1);
        }
        System.out.println(dp[n]);
    }
    public static void check(short n, short count){
        if(n == 4 || n == 3){
            count +=2;
            min = (short)Math.min(min, count);
            return;
        }
        if(n ==2 || n==1){
            count += (n-1);
            min = (short)Math.min(min, count);
            return;
        }
        HashSet<Short> ar = div(n);
        for(short i: ar){
            check((short)(n-i), (short)(count+1));
        }

    }
    public static HashSet<Short> div(short n){
        HashSet<Short> ar = new HashSet<>();
        ar.add((short)1);
        for(short i=2; i*i<=n; i++){
            if(n%i == 0){
                ar.add(i);
                ar.add((short)(n/i));
            }
        }

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