Skip to content

이기훈_Power-of-Three#41

Open
neo622 wants to merge 1 commit into404-my-job-not-found:mainfrom
neo622:Power-of-Three
Open

이기훈_Power-of-Three#41
neo622 wants to merge 1 commit into404-my-job-not-found:mainfrom
neo622:Power-of-Three

Conversation

@neo622
Copy link
Copy Markdown

@neo622 neo622 commented Aug 6, 2025

🧑‍💻 언어 및 제출 결과

  • 사용 언어: JavaScript
  • 통과 여부: ✅

🧠 풀이 설명

var isPowerOfThree = function (n) {
    // 0 이하인 경우는 거듭제곱이 될 수 없음
    if (n < 1) return false;

    // n이 3으로 나누어떨어질 동안 계속 나눔
    while (n % 3 === 0) {
        n = n / 3;
    }

    // 최종적으로 1이면 3의 거듭제곱임
    return n === 1;
};
  • 주석 풀이 참고

📊 시간/공간 복잡도

✅ 어떠한 근거로 시간/공간 복잡도가 이렇게 나왔는지 설명해주세요.

⚡️ 풀이의 속도와 메모리 등을 캡쳐해서 올려주세요.

  • 시간 복잡도: O(n)
  • 공간 복잡도: O(1)

example

📝 추가 설명 (선택)

  • 고민했던 포인트가 있다면 간단히 적어주세요.

🙋‍♂️ 리뷰어에게

  • 리뷰어가 보면 좋을 포인트, 질문, 궁금한 점 등을 작성해 주세요.

@neo622 neo622 added the TeamA Team label for TeamA label Aug 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

TeamA Team label for TeamA

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant