Skip to content

[xeulbn] WEEK 03 Solutions#2729

Merged
DaleSeo merged 3 commits into
DaleStudy:mainfrom
xeulbn:main
Jul 14, 2026
Merged

[xeulbn] WEEK 03 Solutions#2729
DaleSeo merged 3 commits into
DaleStudy:mainfrom
xeulbn:main

Conversation

@xeulbn

@xeulbn xeulbn commented Jul 11, 2026

Copy link
Copy Markdown
Contributor

답안 제출 문제

작성자 체크 리스트

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

검토자 체크 리스트

Important

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

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

@dalestudy

dalestudy Bot commented Jul 11, 2026

Copy link
Copy Markdown
Contributor

📊 xeulbn 님의 학습 현황

이번 주 제출 문제

문제 난이도 유형 분석
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,818 235 2,053 $0.000185
2 1,775 257 2,032 $0.000192
3 1,775 229 2,004 $0.000180
합계 5,368 721 6,089 $0.000557

@xeulbn xeulbn moved this from Solving to In Review in 리트코드 스터디 8기 Jul 11, 2026
@sonshn
sonshn self-requested a review July 11, 2026 03:28

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

시간 복잡도나 공간 복잡도도 고려하셔서 최적의 방법으로 풀이하셨네요! 저도 Java로 준비하고 있는데, 덕분에 많이 배워갑니다. 이번 주도 고생많으셨어요!


return count;
}
}

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.

비트 연산을 활용해서 해결하셨군요! 찾아보니 이런 것을 Hamming이라고 하는 것 같네요


return true;
}
}

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.

저도 정확히 똑같이 풀었습니다! 사실 배열을 활용할까 했었는데, 투 포인터를 사용하는 것이 문제 의도랑 맞는 것 같네요

current.remove(current.size() - 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.

백트래킹으로 해결하셨군요...! 많이 배워갑니다 😊

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

수고하셨습니다. 간결하게 잘 풀어주신 거 같습니다!

커멘트 남겨보았습니다. maximum-subarray에 안쓰는 변수가 있어서 지우고 머지하면 좋을 거 같아 request changed 남겨놓습니다~

Comment thread maximum-subarray/xeulbn.java Outdated
Comment on lines +22 to +28
for (int i=start; i<candidates.length; i++) {
int candidate = candidates[i];

current.add(candidate);
backtrack(candidates, remain - candidate, i, current, result);
current.remove(current.size() - 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.

removeLast를 사용하시면 add -> remove 흐름을 좀더 직관적으로 나타낼 수 있을 거 것 같네요!

Suggested change
for (int i=start; i<candidates.length; i++) {
int candidate = candidates[i];
current.add(candidate);
backtrack(candidates, remain - candidate, i, current, result);
current.remove(current.size() - 1);
}
for (int i=start; i<candidates.length; i++) {
int candidate = candidates[i];
current.add(candidate);
backtrack(candidates, remain - candidate, i, current, result);
current.removeLast();
}

Comment thread decode-ways/xeulbn.java
Comment on lines +18 to +20
int twoDigit =
(s.charAt(i - 2) - '0') * 10
+ (s.charAt(i - 1) - '0');

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.

substring 을 사용하면 좀 더 직관적일 수 있을 거 같아서 고려해보시면 좋을 거 같습니다 !

Suggested change
int twoDigit =
(s.charAt(i - 2) - '0') * 10
+ (s.charAt(i - 1) - '0');
int twoDigit = Integer.parseInt(s.substring(i - 2, 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.

🏷️ 알고리즘 패턴 분석

  • 패턴: Backtracking
  • 설명: 재귀적으로 후보들을 선택해 합이 target이 되도록 조합을 만드는 과정으로, 각 후보를 재사용 가능하게 두고(인덱스 i를 유지) 탐색 공간을 탐색하는 전형적인 백트래킹 풀이입니다.

📊 시간/공간 복잡도 분석

복잡도
Time O(k * C)
Space O(target * n)

피드백: 중복 제거를 위해 시작 인덱스를 유지하고 현재 부분해를 업데이트하며 백트래킹한다.

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

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

Comment thread decode-ways/xeulbn.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.

🏷️ 알고리즘 패턴 분석

  • 패턴: Dynamic Programming, Binary Search
  • 설명: 해당 코드는 문자열을 분할하는 경우의 수를 DP 배열로 누적 합산하는 전형적인 DP 패턴입니다. 연속 두 자리로 묶는 경우를 고려하는 부분은 최적해를 하위 문제의 해로 표현하는 대표적인 DP 예시입니다.

📊 시간/공간 복잡도 분석

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

피드백: 연속 부분 문제를 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
  • 설명: 연속 부분 배열의 합의 최댓값을 구하는 문제로, 각 위치에서 부분해의 최댓값을 유지하며 현재 값과 비교해 더 큰 쪽으로 선택하는 접근이 특징이다. Kadane 알고리즘의 핵심 아이디어로 최적해를 단순한 선형 탐색으로 구한다.

📊 시간/공간 복잡도 분석

복잡도
Time O(n)
Space 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.

🏷️ 알고리즘 패턴 분석

  • 패턴: Bit Manipulation
  • 설명: 주어진 코드는 비트를 왼쪽으로 시프트하며 각 비트를 검사하여 1의 개수를 셈. 비트 조작 연산과 시프트를 활용한 간단한 비트 카운팅으로 목적을 달성합니다.

📊 시간/공간 복잡도 분석

복잡도
Time O(b)
Space O(1)

피드백: 입력 n의 비트 길이에 비례하는 시간으로 동작한다.

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

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

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
  • 설명: 문자열의 좌우를 포인터로 이동하며 비교하는 투 포인터 패턴으로 회문 여부를 판단합니다. 불필요 문자 건너뛰기와 소문자 비교를 통해 선형 시간에 해결합니다.

📊 시간/공간 복잡도 분석

복잡도
Time O(n)
Space O(1)

피드백: 공백 및 특수문자는 건너뛰고 소문자 비교를 수행한다.

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

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

@xeulbn
xeulbn requested a review from parkhojeong July 14, 2026 01:38
@DaleSeo
DaleSeo merged commit 004fa4c into DaleStudy:main Jul 14, 2026
1 check passed
@github-project-automation github-project-automation Bot moved this from In Review to Completed in 리트코드 스터디 8기 Jul 14, 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.

5 participants