public static Boolean check (int c){
HashSet<Integer> hs = new HashSet<>();
for (int i=0; i<=Math.sqrt(c); i++) {
hs.add(i * i);
}
for (int i=0; i<=Math.sqrt(c); i++){
if (hs.contains(c  (i*i)))
return true;
}
return false;
}
Java Solution

@Roham said in Java Solution:
HashSet<Integer> hs = new HashSet<>();
for (int i=0; i<=Math.sqrt(c); i++) { hs.add(i * i); } for (int i=0; i<=Math.sqrt(c); i++){ if (hs.contains(c  (i*i))) return true; } return false;
why I got a TLE when in contest
