This repository was archived by the owner on Mar 18, 2024. It is now read-only.
[2023-09-15] wooyeol #208#229
Merged
Merged
Conversation
Closed
ksumini
approved these changes
Sep 15, 2023
Contributor
There was a problem hiding this comment.
아..!
(target - p_num) - p_num = target - (2 * p_num)이라
두 소수의 차이를 이렇게 표현하신 거군요!!
Member
Author
There was a problem hiding this comment.
아 제가 노트에 쓴 걸 옮겨적다보니 축약해서 적고 설명도 안 적었네요 ㅎㅎ 말씀해주신 내용이 맞습니다!
Contributor
There was a problem hiding this comment.
오 전체적으로 주석이 깔끔하고 이 부분을 딕셔너리로 처리할 생각을 정말 좋은 아이디어라고 생각해요!!
시간도 O(1) 밖에 들지 않고..! 좋은 풀이 감사합니다 우열님!👍👍
zsmalla
approved these changes
Sep 15, 2023
zsmalla
left a comment
Contributor
There was a problem hiding this comment.
dictionary를 활용해서 정렬된 소수 리스트를 효율적으로 활용한 부분이 인상깊었던 풀이였습니다. 고생하셨습니다 우열님!
Contributor
There was a problem hiding this comment.
정렬되어있다면, 소수 크기(p_num)가 target을 넘어가면 break하는 로직을 추가해도 좋을 것 같습니다.
limstonestone
approved these changes
Sep 15, 2023
limstonestone
left a comment
Contributor
There was a problem hiding this comment.
저는 리스트와 셋 자료형을 같이 썼는데 딕셔너리 하나로 대체할 수 있겠네요~~!
감사합니다 !
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR Summary
골드바흐의 추측
풀이시간
20:44 ~ 21:28 (44분)
문제 조건
4 <= N <= 10,000
2 <= target <= 10,000인 짝수
시간 복잡도 :
O(값 입력 + 에라토스테네스의 체 만들기 + 골드바흐의 파티션 찾기)
접근법
무슨 알고리즘으로 풀이 할 수 있을까? -> 구현