Skip to content

[JeonJe] WEEK 02 Solutions#2678

Open
JeonJe wants to merge 5 commits into
DaleStudy:mainfrom
JeonJe:week2
Open

[JeonJe] WEEK 02 Solutions#2678
JeonJe wants to merge 5 commits into
DaleStudy:mainfrom
JeonJe:week2

Conversation

@JeonJe

@JeonJe JeonJe commented Jun 28, 2026

Copy link
Copy Markdown
Contributor

답안 제출 문제

작성자 체크 리스트

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

검토자 체크 리스트

Important

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

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

@dalestudy

dalestudy Bot commented Jun 28, 2026

Copy link
Copy Markdown
Contributor

📊 JeonJe 님의 학습 현황

이번 주 제출 문제

문제 난이도 유형 분석
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 356 49 405 $0.000037
2 723 94 817 $0.000074
3 1,088 153 1,241 $0.000116
4 1,558 184 1,742 $0.000151
5 1,897 211 2,108 $0.000179
합계 5,622 691 6,313 $0.000558

Comment thread 3sum/JeonJe.java

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, Sort
  • 설명: 3sum 문제에서 정렬 후 좌우 포인터를 이동하며 합이 0인 경우를 찾는 전형적인 Two Pointers 패턴이며 중복 제거를 위한 포인터 이동 로직이 포함됩니다. 추가적으로 정렬이 선행되어야 하므로 Sort도 관찰됩니다.

📊 시간/공간 복잡도 분석

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

피드백: 정렬 O(n log n) 이후 두 포인터 반복으로 각 x에 대해 선형 탐색으로 전체 복잡도는 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, Hash Map / Hash Set
  • 설명: 피보나치 형태의 문제로 부분 문제를 저장하며 재귀+메모이제이션으로 풀어 Dynamic Programming 패턴에 해당합니다. 해시 맵/셋은 사용되지 않지만 memo 배열로 중복 계산을 제거하는 점에서 DP의 대표적 특징이 드러납니다.

📊 시간/공간 복잡도 분석

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

피드백: 상수 크기의 memo를 재사용해 중복 계산을 막으나 초기화가 매 호출마다 필요하지 않도록 개선 여지 있음.

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

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, Prefix-Drefix, Dynamic Programming
  • 설명: 이 풀이는 각 위치의 왼쪽 곱과 오른쪽 곱을 미리 계산해 곱셈 결과를 구하는 방식으로, O(n) 시간에 O(1) 추가 공간으로 배열의 누적 곱을 이용한다. 두 방향에서의 누적 곱을 합성하는 패턴으로 해석할 수 있다.

📊 시간/공간 복잡도 분석

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

피드백: 두 파트 누적곱으로 모든 위치의 곱을 계산하므로 추가 공간을 최소화했습니다.

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

Comment thread valid-anagram/JeonJe.java

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, Bit Manipulation
  • 설명: 두 문자열의 문자 분포를 비교하기 위해 고정 크기 배열로 카운트를 세는 방법으로 해시 맵/세트의 역할을 대체하며, 각 문자 등장 횟수를 비교해 동등 여부를 판단합니다. 비트 조작은 직접 사용되진 않지만 배열 인덱스로 상수 공간에 매핑하는 패턴과 유사합니다.

📊 시간/공간 복잡도 분석

유저 분석 실제 분석 결과
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.

🏷️ 알고리즘 패턴 분석

  • 패턴: Binary Search, Depth-First Search, Divide and Conquer, Hash Map / Hash Set
  • 설명: BST 유효성 검사 문제에서 재귀적으로 범위를 좁혀가며 좌우 자식 노드를 탐색하는 방식은 이진 검색 트리의 성질을 활용하는 패턴이다. 재귀적 탐색(DFS)으로 각 노드에 대해 허용 범위를 추적하고, 범위를 나눠 문제를 분해한다.

📊 시간/공간 복잡도 분석

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

피드백: 부모-자식 간의 흐름을 범위로 추적해 BST 여부를 검증합니다.

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

@JeonJe JeonJe moved this from Solving to In Review in 리트코드 스터디 8기 Jul 2, 2026

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

전제님 코드를 보면서 배워갑니다!
한 주동안 고생하셨습니다. 다음주도 화이팅이에요!

// TC: O(n)
// SC: O(n)
class Solution {
static int[] memo = new int[46];

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.

문제 조건에 맞춰서 46으로 미리 초기화해두신부분 꼼꼼해서 인상깊습니다!

Comment on lines +20 to +28
private int dfs(int num) {

//이미 계산한적이 있으면
if (memo[num] != 0) {
return memo[num];
}

memo[num] = dfs(num - 1) + dfs(num - 2);
return memo[num];

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.

DFS로 문제를 푸셨는데, 언제 DFS로 풀고 언제 bottom-up으로 푸시는지 전제님만의 기준이 궁금합니다!

// SC: O(h)
class Solution {
public boolean isValidBST(TreeNode root) {
return isValid(root, Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY);

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.

Double 최대, 최솟값 상수를 저렇게 썼군요 배워갑니다!

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