Skip to content

[j2h30728] WEEK 02 Solutions#2705

Merged
j2h30728 merged 6 commits into
DaleStudy:mainfrom
j2h30728:week2
Jul 4, 2026
Merged

[j2h30728] WEEK 02 Solutions#2705
j2h30728 merged 6 commits into
DaleStudy:mainfrom
j2h30728:week2

Conversation

@j2h30728

@j2h30728 j2h30728 commented Jul 4, 2026

Copy link
Copy Markdown
Contributor

답안 제출 문제

작성자 체크 리스트

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

검토자 체크 리스트

Important

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

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

@dalestudy

dalestudy Bot commented Jul 4, 2026

Copy link
Copy Markdown
Contributor

📊 j2h30728 님의 학습 현황

이번 주 제출 문제

문제 난이도 유형 분석
3sum Medium ✅ 의도한 유형
climbing-stairs Easy ✅ 의도한 유형
product-of-array-except-self Medium ✅ 의도한 유형
valid-anagram Easy ✅ 의도한 유형
validate-binary-search-tree Medium ✅ 의도한 유형

누적 학습 요약

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

문제 풀이 현황

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

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

🔢 API 사용량 (gpt-5-nano)
요청 입력 토큰 출력 토큰 합계 비용
1 1,911 224 2,135 $0.000185
2 1,976 226 2,202 $0.000189
합계 3,887 450 4,337 $0.000374

@ICE0208 ICE0208 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

2주차 문제풀이 고생하셨습니다~

Comment thread valid-anagram/j2h30728.ts

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

공간 복잡도를 O(n)으로 적어주셨는데,
문제 조건에 s and t consist of lowercase English letters.라고 나와 있으니
Map에 저장되는 key 개수가 최대 26개라서 O(1)이 맞는 것 같습니다!

혹은 가능한 문자 집합의 크기를 k라고 본다면, 봇이 제안한 대로 O(k)도 맞는 표현인 듯합니다!

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

오 감사합니다!

Comment thread valid-anagram/j2h30728.ts

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

저는 각각 따로 개수를 세서 비교하는 방식만 생각했는데,
하나는 증가시키고 다른 하나는 감소시켜서 최종 값이 0인지 확인하는 방법도 있었네요!

좋은 접근 방식 배워갑니다~

Comment thread 3sum/j2h30728.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.

🏷️ 알고리즘 패턴 분석

  • 패턴: Two Pointers, Sorting, Hash Map / Hash Set
  • 설명: 3sum에서 정렬 후 두 포인터(left, right)를 이동하며 합이 0인 경우를 찾는 전형적인 Two Pointers 패턴을 사용합니다. 중복 제거를 위한 조건도 포함되어 있어 O(n^2) 시간 복잡도와 O(1) 추가 공간으로 구현됩니다.

📊 시간/공간 복잡도 분석

유저 분석 실제 분석 결과
Time O(n^2) O(n^2)
Space O(1) O(1)

피드백: 정렬과 두 포인터를 이용해 중복 제거를 처리하고 있으며 평균적으로 O(n^2) 시간이 소요됩니다.

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

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 패턴으로 해결한다. 순차적으로 이전 두 값을 유지하며 최적 해를 구하는 점이 특징이다.

📊 시간/공간 복잡도 분석

유저 분석 실제 분석 결과
Time O(n) O(n)
Space O(1) O(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, Hash Map / Hash Set
  • 설명: 연속되는 두 포인터(left, right)를 이용해 각 위치의 곱을 구하는 패턴으로, 중간 배열 없이 좌우 누적 곱을 이용하는 방식이 핵심이다. 문제의 요구에 맞춰 한 방향에서의 누적을 다른 방향에서 곱해 최종 결과를 얻는 구조다.

📊 시간/공간 복잡도 분석

유저 분석 실제 분석 결과
Time O(n) O(n)
Space O(1) O(1)

피드백: 두 순회를 통해 추가 배열 없이 결과를 얻습니다.

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

Comment thread valid-anagram/j2h30728.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.

🏷️ 알고리즘 패턴 분석

  • 패턴: Hash Map / Hash Set, Two Pointers, Greedy, Dynamic Programming
  • 설명: 두 문자열의 각 문자 빈도를 해시 맵으로 비교하는 방식으로 anagram 여부를 판단합니다. 입력 길이가 같고, 해시 맵을 이용해 문자 등장 횟수를 증가/감소시키는 방식은 해시 기반 카운팅 패턴에 해당합니다. 해당 코드는 다른 패턴보다 이 패턴이 가장 적합합니다.

📊 시간/공간 복잡도 분석

유저 분석 실제 분석 결과
Time O(n) O(n)
Space O(n) O(k)

피드백: 문자 빈도 맵을 사용해 각 문자 차이를 누적 비교합니다.

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

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.

🏷️ 알고리즘 패턴 분석

  • 패턴: Binary Search
  • 설명: BST 유효성 검사로 트리의 각 노드를 중위 값 범위로 재귀적으로 검증하는 패턴. 재귀를 이용한 Divide and Conquer 방식으로 트리 구조를 탐색한다.

📊 시간/공간 복잡도 분석

유저 분석 실제 분석 결과
Time O(n) O(n)
Space O(h) O(h)

피드백: 각 노드에 대해 허용 범위를 좁혀나가며 유효성 검사.

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

@j2h30728 j2h30728 merged commit a9d860a into DaleStudy:main Jul 4, 2026
1 check passed
@github-project-automation github-project-automation Bot moved this from In Review to Completed in 리트코드 스터디 8기 Jul 4, 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