Skip to content

[parkhojeong] WEEK 11 Solutions - #2851

Merged
parkhojeong merged 1 commit into
DaleStudy:mainfrom
parkhojeong:week11
Sep 5, 2026
Merged

[parkhojeong] WEEK 11 Solutions#2851
parkhojeong merged 1 commit into
DaleStudy:mainfrom
parkhojeong:week11

Conversation

@parkhojeong

@parkhojeong parkhojeong commented Sep 5, 2026

Copy link
Copy Markdown
Contributor

답안 제출 문제

작성자 체크 리스트

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

검토자 체크 리스트

Important

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

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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🏷️ 알고리즘 패턴 분석

missing-number/parkhojeong.py
class Solution:
    def missingNumber(self, nums: List[int]) -> int:
        N = max(nums)
        num_set = set()

        for i in range(N + 1):
            num_set.add(i)

        for num in nums:
            num_set.remove(num)

        if len(num_set) == 0:
            return N + 1
        else:
            return num_set.pop()
  • 패턴: Hash Map / Hash Set, Greedy, Binary Search, Dynamic Programming, Two Pointers, Sliding Window, Backtracking, Divide and Conquer, Union Find, Trie, Bit Manipulation, DFS, BFS, Monotonic Stack, Heap / Priority Queue
  • 설명: 집합을 이용해 존재 여부를 체크하는 방식으로 누락된 수를 찾는다. 전체 가능한 숫자 세트를 만든 뒤 주어진 nums에서 제거하는 해시 셋 활용 패턴에 해당한다.

📊 시간/공간 복잡도 분석

복잡도
Time O(N)
Space O(N)

피드백: 정수 집합을 만들어 가능한 모든 값을 저장한 뒤 남은 값을 찾는다.

개선 제안: 현재 구현은 최악의 경우 추가적 공간이 필요하므로, 가정된 수의 합이나 비트 연산 등을 이용한 상수 공간 방법을 고려해볼 수 있다.

💡 풀이에 시간/공간 복잡도를 주석으로 남겨보세요!

@dalestudy

dalestudy Bot commented Sep 5, 2026

Copy link
Copy Markdown
Contributor

📊 parkhojeong 님의 학습 현황

이번 주 제출 문제

문제 난이도 유형 분석
missing-number Easy ⚠️ 유형 불일치

누적 학습 요약

  • 풀이한 문제: 45 / 75개
  • 이번 주 유형 일치율: 0% (1문제 중 0문제 일치)

문제 풀이 현황

카테고리 진행도 완료
Dynamic Programming ■■■■■■□ 9 / 11 (Easy 1, Medium 8)
Array ■■■■■■□ 8 / 10 (Medium 5, Easy 3)
String ■■■■■■□ 8 / 10 (Medium 5, Easy 3)
Matrix ■■■■■□□ 3 / 4 (Medium 3)
Linked List ■■■■■□□ 4 / 6 (Easy 3, Hard 1)
Heap ■■■■■□□ 2 / 3 (Hard 1, Medium 1)
Graph ■■■■□□□ 5 / 8 (Medium 5)
Binary ■■■□□□□ 2 / 5 (Easy 2)
Tree ■■■□□□□ 5 / 14 (Medium 3, Easy 2)
Interval □□□□□□□ 0 / 5 ← 아직 시작 안 함

🤖 이 댓글은 GitHub App을 통해 자동으로 작성되었습니다.

🔢 API 사용량 (gpt-5-nano)
요청 입력 토큰 출력 토큰 합계 비용
1 313 52 365 $0.000036

Comment on lines +3 to +4
N = max(nums)
num_set = set()

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

정답 범위는 항상 0~n이니까 max 대신 len을 쓰면 더 효율적일 것 같아요!

Comment on lines +4 to +7
num_set = set()

for i in range(N + 1):
num_set.add(i)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

num_set = set(range(N + 1)) 로 한 줄에 됩니다! 그리고 크로드한테 물어보니까 저 코드는 파이썬 레벨 루프가 C 레벨로 내려가서 눈에 띄게 빨라진다고 합니다!!👍

@Yiseull Yiseull left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

리뷰를 늦게 남겨서, 제 코멘트는 참고만 하시고 바로 머지하시면 될 것 같아요! 문제 푸느라 고생하셨습니다!!👍

@parkhojeong
parkhojeong merged commit 185bbb1 into DaleStudy:main Sep 5, 2026
3 checks passed
@github-project-automation github-project-automation Bot moved this from In Review to Completed in 리트코드 스터디 8기 Sep 5, 2026
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