Skip to content

[Zero-1016] WEEK 03 Solutions#2708

Open
Zero-1016 wants to merge 6 commits into
DaleStudy:mainfrom
Zero-1016:week-3
Open

[Zero-1016] WEEK 03 Solutions#2708
Zero-1016 wants to merge 6 commits into
DaleStudy:mainfrom
Zero-1016:week-3

Conversation

@Zero-1016

@Zero-1016 Zero-1016 commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

답안 제출 문제

작성자 체크 리스트

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

검토자 체크 리스트

Important

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

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

@dalestudy

dalestudy Bot commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

⚠️ Week 설정이 누락되었습니다

프로젝트에서 Week를 설정해주세요!

설정 방법

  1. PR 우측의 Projects 섹션에서 리트코드 스터디 옆 드롭다운(▼) 클릭
  2. 현재 주차를 선택해주세요 (예: Week 14(current) 또는 Week 14)

📚 자세한 가이드 보기


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

@dalestudy

dalestudy Bot commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

📊 Zero-1016 님의 학습 현황

이번 주 제출 문제

문제 난이도 유형 분석
combination-sum Medium ✅ 의도한 유형
decode-ways Medium ✅ 의도한 유형
maximum-subarray Medium ✅ 의도한 유형
number-of-1-bits Easy ⚠️ 유형 불일치
valid-palindrome Easy ✅ 의도한 유형

누적 학습 요약

  • 풀이한 문제: 10 / 75개
  • 이번 주 유형 일치율: 80% (5문제 중 4문제 일치)

문제 풀이 현황

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

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

🔢 API 사용량 (gpt-5-nano)
요청 입력 토큰 출력 토큰 합계 비용
1 1,072 277 1,349 $0.000164
2 1,255 263 1,518 $0.000168
3 1,413 235 1,648 $0.000165
4 2,562 208 2,770 $0.000211
합계 6,302 983 7,285 $0.000708

@namuuCY namuuCY self-requested a review July 5, 2026 02:40

@namuuCY namuuCY 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.

안녕하세요! 이번 주차 리뷰를 맡게된 장철영이라고 합니다.

우선 현재 푸신 문제까지 리뷰를 남겨놨고,
나머지 문제들 업데이트되면 추가 리뷰 드리도록 하겠습니다!

* 시간 복잡도 O(N)
* 공간 복잡도 O(1)
*/
function hammingWeight2(n: number): number {

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.

비트연산자로 하는 풀이 배워갑니다!

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.

🏷️ 알고리즘 패턴 분석

  • 패턴: Backtracking, Dynamic Programming, Greedy, Divide and Conquer, Hash Map / Hash Set
  • 설명: 두 함수 모두 후보를 탐색하고 조건에 맞는 경로를 재귀적으로 구성하는 백트래킹 패턴을 사용합니다. 최적화 버전은 시작 인덱스 고정으로 중복 방문을 피하는 기법과 가지치기를 통해 탐색 공간을 축소합니다. 다만 실제로는 백트래킹이 중심이며, 결과 처리에서 중복 제거에 Set을 사용하는 점이 보조적으로 나타납니다.

📊 시간/공간 복잡도 분석

ℹ️ 이 파일에는 2가지 풀이가 포함되어 있어 각각 분석합니다.

풀이 1: combinationSum1 — Time: O(2^n) / Space: O(D)
복잡도
Time O(2^n)
Space O(D)

피드백: 중복 순열 탐색으로 인해 불필요한 탐색이 많아 지수적 시간 복잡도가 증가합니다.

개선 제안: 고려해볼 만한 대안: start 인덱스를 도입해 중복 순열을 제거하고, 후보를 정렬한 뒤 가지치기를 적용하면 시간 복잡도를 크게 줄일 수 있습니다.

풀이 2: combinationSum2 — Time: ❌ O(nᴰ × D) → O(2^n) / Space: ❌ O(D + 정답 개수 × D) → O(D)
유저 분석 실제 분석 결과
Time O(nᴰ × D) O(2^n)
Space O(D + 정답 개수 × D) O(D)

피드백: 정렬과 시작 인덱스 도입으로 중복 탐색을 막고, 남는 값을 빠르게 단절하는 가지치기 방식이 효과적입니다.

개선 제안: 현재 구현이 적절해 보입니다.

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

Comment thread decode-ways/Zero-1016.ts

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.

🏷️ 알고리즘 패턴 분석

  • 패턴: Dynamic Programming, Two Pointers
  • 설명: 해당 코드는 입력 문자열을 한 자리/두 자리로 나눠 해석하는 방법으로, dp[i]를 이용해 가능한 해를 누적합산한다. 변수 prev2, prev1로 최적화된 공간 복잡도 O(1) DP 패턴이며, 부분 문제를 합쳐 전체 해를 구하는 특징이 있다.

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.

🏷️ 알고리즘 패턴 분석

  • 패턴: Greedy, Dynamic Programming
  • 설명: 연속 부분 배열의 합을 한 번에 최대화하는 Kadane 알고리즘으로, 현재 구간의 합과 전체 최댓값을 갱신하는 그리디/동적 프로그래밍의 조합 패턴입니다.

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.

🏷️ 알고리즘 패턴 분석

  • 패턴: Bit Manipulation
  • 설명: 두 함수 모두 비트 연산으로 1의 비트 개수를 구한다. 비트마스크와 비트 시프트를 활용하는 대표적 비트 조작 기법으로 분류된다.

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.

🏷️ 알고리즘 패턴 분석

  • 패턴: Two Pointers, Greedy
  • 설명: 두 포인터(left, right)를 이용해 문자열을 양쪽에서 비교하며 조건에 맞지 않으면 건너뛰고, 같으면 이동하는 방식으로 팰린드롬 여부를 판단한다. 추가로 불필요한 문자 제거를 동반한 최적화로 O(N) 시간, O(1) 공간을 달성한다.

@Zero-1016 Zero-1016 requested a review from namuuCY July 5, 2026 06:22
@Zero-1016 Zero-1016 moved this from Solving to In Review in 리트코드 스터디 8기 Jul 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Status: In Review

Development

Successfully merging this pull request may close these issues.

2 participants