Skip to content

[Chapse57] WEEK 01 Solution #1142

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 8, 2025
Merged

[Chapse57] WEEK 01 Solution #1142

merged 1 commit into from
Apr 8, 2025

Conversation

chapse57
Copy link
Contributor

@chapse57 chapse57 commented Mar 31, 2025

답안 제출 문제

  • 문제 1
  • 문제 2
  • 문제 3

작성자 체크 리스트

  • 우측 메뉴에서 PR을 Projects에 추가해주세요.
  • Projects의 오른쪽 버튼(▼)을 눌러 확장한 뒤, Week를 현재 주차로 설정해주세요.
  • 문제를 모두 푸시면 프로젝트에서 StatusIn Review로 설정해주세요.
  • 코드 검토자 1분 이상으로부터 승인을 받으셨다면 PR을 병합해주세요.

검토자 체크 리스트

Important

본인 답안 제출 뿐만 아니라 다른 분 PR 하나 이상을 반드시 검토를 해주셔야 합니다!

  • 바로 이전에 올라온 PR에 본인을 코드 리뷰어로 추가해주세요.
  • 본인이 검토해야하는 PR의 답안 코드에 피드백을 주세요.
  • 토요일 전까지 PR을 병합할 수 있도록 승인해주세요.

Sorry, something went wrong.

@github-actions github-actions bot added the py label Mar 31, 2025
@chapse57 chapse57 moved this from Solving to In Review in 리트코드 스터디 4기 Mar 31, 2025
@chapse57 chapse57 moved this from In Review to Solving in 리트코드 스터디 4기 Mar 31, 2025
@chapse57 chapse57 changed the title [Chapse57] WEEK 01 Solution (Palindrome Number Solution) [Chapse57] WEEK 01 Solution Mar 31, 2025
@chapse57 chapse57 requested a review from DaleSeo March 31, 2025 01:03
@itsChrisJang itsChrisJang self-requested a review March 31, 2025 01:05
@chapse57 chapse57 marked this pull request as draft March 31, 2025 01:19
@chapse57 chapse57 marked this pull request as ready for review March 31, 2025 01:19
Copy link
Contributor Author

@chapse57 chapse57 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

test

Copy link
Member

@itsChrisJang itsChrisJang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

초기 예외처리가 좋습니다. 특히 x < 0 음수 케이스와 x % 10 == 0 조건을 함께 체크해서 불필요한 계산을 빠르게 차단한 점이 깔끔합니다.

div를 사용해서 왼쪽/오른쪽 자릿수를 비교하는 방식 대신, 숫자 절반만 뒤집어서 비교하는 방법을 사용해 코드 흐름이 훨씬 간결합니다. while 루프 하나로 자연스럽게 숫자를 반으로 줄이는 로직이 이해하기 쉽습니다.

revertedNumber가 x보다 커질 때 루프를 종료하는 로직 덕분에 전체 숫자의 절반까지만 처리하고, 불필요한 계산을 하지 않아 시간복잡도 O(log₁₀ n) 을 잘 유지했습니다.

짝수/홀수 길이 차이를 x == revertedNumber or x == revertedNumber // 10으로 단 한 줄에 처리한 것도 깔끔합니다. 추가 분기 없이 한 번에 비교할 수 있어 코드 가독성이 좋습니다.

전반적으로 메모리를 추가로 사용하지 않고(공간복잡도 O(1)), 자연스럽게 숫자를 다루는 점에서 효율성과 실용성을 모두 갖춘 구현이라고 생각합니다.

@chapse57 chapse57 merged commit 8e0008e into DaleStudy:main Apr 8, 2025
3 checks passed
@github-project-automation github-project-automation bot moved this from Solving to Completed in 리트코드 스터디 4기 Apr 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Completed
Development

Successfully merging this pull request may close these issues.

None yet

3 participants