Skip to content

[s0ooo0k] WEEK 01 solutions #1709

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 4 commits into from
Jul 26, 2025
Merged

[s0ooo0k] WEEK 01 solutions #1709

merged 4 commits into from
Jul 26, 2025

Conversation

s0ooo0k
Copy link
Member

@s0ooo0k s0ooo0k commented Jul 23, 2025

답안 제출 문제

작성자 체크 리스트

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

검토자 체크 리스트

Important

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

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

@mumunuu mumunuu self-requested a review July 23, 2025 16:16
Set<Integer> set = new HashSet<>();

for(int n : nums) {
if(set.contains(n)){
Copy link

Choose a reason for hiding this comment

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

Set을 이용한 제너럴한 문제 풀이를 하시긴 했는데
이렇게 되면 중복이 나올때까지, contains와 add 두개의 함수가 매번 호출되니까,
add를 할 때, 실패하면 한번의 함수로 판단할 수 있습니다.

    public boolean containsDuplicate(int[] nums) {

        Set<Integer> set = new HashSet<>();

        for (int num : nums) {

            boolean isAdded = set.add(num);

            if (!isAdded) {
                return true;
            }
        }

        return false;

    }

Copy link
Member Author

Choose a reason for hiding this comment

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

더 좋은 방법이네요! 감사합니다!

@mumunuu
Copy link

mumunuu commented Jul 25, 2025

두번 째 문제는 오늘, 내일 중으로 리뷰하겠습니다!! (two sum)

* 시간복잡도 O(n)
* 공간복잡도 O(n)
*/
public int[] twoSum(int[] nums, int target) {
Copy link

Choose a reason for hiding this comment

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

lgtm

@mumunuu
Copy link

mumunuu commented Jul 26, 2025

두개만 푸시는건가요? 일단 approve 해드렸습니다 :)

@s0ooo0k s0ooo0k moved this from Solving to Completed in 리트코드 스터디 5기 Jul 26, 2025
@s0ooo0k
Copy link
Member Author

s0ooo0k commented Jul 26, 2025

두개만 푸시는건가요? 일단 approve 해드렸습니다 :)

네, Week1 풀이를 늦게 시작하여 두문제만 진행하였습니다 :)
리뷰 감사합니다!

@s0ooo0k s0ooo0k merged commit 1ae6771 into DaleStudy:main Jul 26, 2025
1 check passed
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.

2 participants