(프로그래머스) 정수 제곱근 판별

유지원·2022년 5월 4일
0

프로그래머스

목록 보기
43/66


문제 링크

https://programmers.co.kr/learn/courses/30/lessons/12934?language=javascript


Javascript

function solution(n) {
  let num = Math.sqrt(n)
  if(num % 1 === 0 ) return (num+1) * (num+1)
  else return -1
}
profile
👋 https://github.com/ujw0712

0개의 댓글