Skip to content

[Chanz] WEEK 06 Solutions - #2791

Open
Chanz82 wants to merge 3 commits into
DaleStudy:mainfrom
Chanz82:week-06
Open

[Chanz] WEEK 06 Solutions#2791
Chanz82 wants to merge 3 commits into
DaleStudy:mainfrom
Chanz82:week-06

Conversation

@Chanz82

@Chanz82 Chanz82 commented Aug 1, 2026

Copy link
Copy Markdown
Contributor

답안 제출 문제

작성자 체크 리스트

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

검토자 체크 리스트

Important

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

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

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 패턴이 모두 적용됩니다.

📊 시간/공간 복잡도 분석

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

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

피드백: 양 끝 포인터를 좁혀가며 현재 넓이와 남은 영역의 가능성을 비교하여 최댓값을 갱신합니다.

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

풀이 2: WordDictionary.addWord — Time: O(len(word)) / Space: O(total_chars_stored)
복잡도
Time O(len(word))
Space O(total_chars_stored)

피드백: 각 글자마다 노드를 생성하고 끝에 '#'를 두어 단어 종료를 표시합니다.

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

풀이 3: WordDictionary.search — Time: O(branching_factor^length) / Space: O(length_of_word_depth)
복잡도
Time O(branching_factor^length)
Space O(length_of_word_depth)

피드백: 점 와일드카드를 처리하기 위해 분기 탐색을 재귀적으로 수행합니다.

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

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

피드백: 닫는 괄호를 만났을 때 스택이 비어있거나 매칭되지 않으면 실패하고, 끝난 후 스택이 비어있어야 유효합니다.

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

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

@dalestudy

dalestudy Bot commented Aug 1, 2026

Copy link
Copy Markdown
Contributor

📊 Chanz82 님의 학습 현황

이번 주 제출 문제

문제 난이도 유형 분석
container-with-most-water Medium ✅ 의도한 유형
design-add-and-search-words-data-structure Medium ✅ 의도한 유형
valid-parentheses Easy ✅ 의도한 유형

누적 학습 요약

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

문제 풀이 현황

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

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

🔢 API 사용량 (gpt-5-nano)
요청 입력 토큰 출력 토큰 합계 비용
1 1,179 133 1,312 $0.000112

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.

🏷️ 알고리즘 패턴 분석

  • 패턴: Trie, Hash Map / Hash Set, Backtracking
  • 설명: 단어 트리(Trie) 구조를 사용해 단어를 저장하고, 점(.) 와일드카드를 재귀적으로 탐색하는 방식으로 구현되어 있습니다. 해시 맵으로 트리의 간선을 표현하고, 부분 검색 시 백트래킹으로 가능한 경로를 모두 시도합니다.

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.

🏷️ 알고리즘 패턴 분석

  • 패턴: Stack
  • 설명: 주어진 코드는 스택을 사용해 여는 괄호를 push하고 닫는 괄호를 팝하며 매칭 여부를 확인한다. 한 번에 한 문자씩 순회하며 유효한 괄호 쌍인지 검증하므로 스택 기반의 패턴에 해당한다.

@Chanz82 Chanz82 changed the title [Chanz] WEEK 06 Solution [Chanz] WEEK 06 Solutions Aug 1, 2026
@parkhojeong
parkhojeong self-requested a review August 1, 2026 12:30

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

수고하셨습니다.

Comment on lines +4 to +8
ch_map = {}

ch_map[")"] = "("
ch_map["}"] = "{"
ch_map["]"] = "["

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.

선언 시점에 할당하면 좀 더 간결해 질 거 같네요.

Suggested change
ch_map = {}
ch_map[")"] = "("
ch_map["}"] = "{"
ch_map["]"] = "["
ch_map = {
")": "(",
"}": "{",
"]": "["
}

right = len(height) - 1
max_water = 0

while left <= right:

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.

left == right인 경우는 필요 없어서 while left < right로 해줘도 될 거 같습니다.

start_branch = start_branch[ch]
elif ch == ".":
for branch in start_branch.values():
if nested_search(branch, word[idx+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.

slicing을 쓰면 O(n)이라 slicing을 안 쓰도록 풀어보셔도 좋을 거 같아요.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Status: Solving

Development

Successfully merging this pull request may close these issues.

2 participants