Beakjoon&프로그래머스/Java
[프로그래머스/Java] 정수 제곱근 판별
현장
2025. 2. 23. 17:17
-Code
class Solution {
public long solution(long n) {
double sqrt = Math.sqrt(n);
return sqrt == (long) sqrt ? (long) Math.pow(sqrt + 1, 2) : -1;
}
}