For this Question: Given an integer N. Determine if it has exactly 3 positive divisors all of which are pairwise distinct.<b>User Task:</b>
Since this will be a functional problem, you don't have to take input. You just have to complete the function <b>solve()</b> that takes an integer N as a parameter.

<b>Constraints</b>
1<=N<=10<sup>12</sup>Return "Yes" if the number has exactly three distinct positive divisors and "No" otherwise.Sample Input:
4

Sample Output:
Yes

4 has only three divisors 1, 2 and 4., I have written this Solution Code: class Solution {
    public static String solve(long n) {
        final int s = 1000001;
        BitSet p = new BitSet(s);
        p.set(0);
        p.set(1);
        for (int i = 2; i * i < s; i++) {
            for (int j = i * i; j < s && !p.get(i); j += i) {
                p.set(j);
            }
        }
        long r = (long) Math.sqrt(n);
        return (r * r == n && !p.get((int) r)) ? "Yes" : "No";
    }
}
, In this Programming Language: Java, Now tell me if this Code is compilable or not?