Skip to content

[sonshn] WEEK 03 Solutions#2730

Merged
sonshn merged 13 commits into
DaleStudy:mainfrom
sonshn:main
Jul 11, 2026
Merged

[sonshn] WEEK 03 Solutions#2730
sonshn merged 13 commits into
DaleStudy:mainfrom
sonshn:main

Conversation

@sonshn

@sonshn sonshn commented Jul 11, 2026

Copy link
Copy Markdown
Contributor

답안 제출 문제

작성자 체크 리스트

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

검토자 체크 리스트

Important

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

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

@sonshn sonshn self-assigned this Jul 11, 2026
@github-actions github-actions Bot added the java label Jul 11, 2026
@dalestudy

dalestudy Bot commented Jul 11, 2026

Copy link
Copy Markdown
Contributor

📊 sonshn 님의 학습 현황

이번 주 제출 문제

문제 난이도 유형 분석
climbing-stairs Easy ✅ 의도한 유형
number-of-1-bits Easy ⚠️ 유형 불일치
valid-anagram Easy ✅ 의도한 유형
valid-palindrome Easy ✅ 의도한 유형

누적 학습 요약

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

문제 풀이 현황

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

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

🔢 API 사용량 (gpt-5-nano)
요청 입력 토큰 출력 토큰 합계 비용
1 1,061 158 1,219 $0.000116
2 1,380 148 1,528 $0.000128
3 1,380 184 1,564 $0.000143
합계 3,821 490 4,311 $0.000387

* 시간 복잡도: O(n)
* 공간 복잡도: O(1)
*/
class Solution {

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.

저는 문자열을 파싱하고나서 유효성 검사하는 방법이었는데, 파싱과 유효성을 동시에 검사하면 공간복잡도를 좀 더 줄일 수 있는 것 같아 보여서 좋아보입니다 !!

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

고생하셨습니다~~

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
  • 설명: 갈 수 있는 방법의 수를 피보나치 형태로 점화하는 DP 방식으로 해결합니다. dp 배열로 이전 두 단계의 합을 현재 단계로 확장하는 전형적인 동적계획법 패턴입니다.

📊 시간/공간 복잡도 분석

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

풀이 1: Solution.climbStairs — Time: O(n) / Space: O(n)
복잡도
Time O(n)
Space O(n)

피드백: 선형 시간으로 각 i에 대해 이전 두 값을 더해 계단 수를 구한다. 추가 공간으로 dp 배열이 필요하다.

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

풀이 2: sonshn.hammingWeight — Time: O( number of bits ) / Space: O(1)
복잡도
Time O( number of bits )
Space O(1)

피드백: 정수 비트 수만큼 루프를 돌며 각 비트를 확인한다. 공간은 상수이다.

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

풀이 3: Solution.isAnagram — Time: O(n log n) / Space: O(n)
복잡도
Time O(n log n)
Space O(n)

피드백: 정렬을 이용한 비교로 구현되었으며, 두 문자열의 길이를 n이라고 하면 시간은 O(n log n)이다.

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

풀이 4: Solution.isPalindrome — Time: O(n) / Space: O(1)
복잡도
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의 개수를 세는 패턴으로, 비트 연산과 오른쪽 쉬프트를 이용한 비트 카운팅이다.

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

🏷️ 알고리즘 패턴 분석

  • 패턴: Binary Search, Hash Map / Hash Set, Sorting
  • 설명: 주요 아이디어는 문자열을 문자 배열로 변환하고 정렬한 뒤 서로 비교하는 방식으로 동일 문자 구성인지 판단한다. 정렬은 O(n log n) 시간, O(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
  • 설명: 문자열의 양 끝에서 문자들을 비교하며, 비문자도 건너뛰고 대소문자 구분 없이 비교하므로 두 포인터가 서로를 향해 진행하는 패턴이 핵심이다. 일반적인 구현으로는 Two Pointers에 해당하며, 간단한 비교 로직은 그 자체로 Greedy에 준하는 의사결정(필요한 문자만 비교)으로 볼 수 있음.

@sonshn sonshn moved this from Solving to Completed in 리트코드 스터디 8기 Jul 11, 2026
@sonshn sonshn merged commit 30e11eb into DaleStudy:main Jul 11, 2026
1 check passed

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

👍 수고하셨습니다

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.

3 participants