Skip to content

[ICE0208] WEEK 06 Solutions - #2788

Merged
ICE0208 merged 6 commits into
DaleStudy:mainfrom
ICE0208:week06
Aug 1, 2026
Merged

[ICE0208] WEEK 06 Solutions#2788
ICE0208 merged 6 commits into
DaleStudy:mainfrom
ICE0208:week06

Conversation

@ICE0208

@ICE0208 ICE0208 commented Aug 1, 2026

Copy link
Copy Markdown
Member

답안 제출 문제

작성자 체크 리스트

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

검토자 체크 리스트

Important

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

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

@dalestudy

dalestudy Bot commented Aug 1, 2026

Copy link
Copy Markdown
Contributor

📊 ICE0208 님의 학습 현황

이번 주 제출 문제

문제 난이도 유형 분석
container-with-most-water Medium ✅ 의도한 유형
design-add-and-search-words-data-structure Medium ✅ 의도한 유형
longest-increasing-subsequence Medium ⚠️ 유형 불일치
spiral-matrix Medium ✅ 의도한 유형
valid-parentheses Easy ✅ 의도한 유형

누적 학습 요약

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

문제 풀이 현황

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

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

🔢 API 사용량 (gpt-5-nano)
요청 입력 토큰 출력 토큰 합계 비용
1 2,165 217 2,382 $0.000195
2 2,156 203 2,359 $0.000189
합계 4,321 420 4,741 $0.000384

@daehyun99
daehyun99 self-requested a review August 1, 2026 06:55

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

안녕하세요! 이번 주 리뷰를 맡은 김대현입니다.

전반적으로 코드도 깔끔하고 최적화 잘해서 풀어주셨네요.

#282 문제에 대해서만 코멘트를 남겨놨는데, 시간이 되신다면 풀어보시는 것도 좋을 것 같습니다.

고생 많으셨습니다!!!

Comment thread spiral-matrix/ICE0208.py

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.

inRange 함수와 visit를 활용해서, matrix의 범위인지 체크하는 방법도 좋은 것 같네요!
다만, 공간 복잡도가 matrix만큼 추가로 필요하게 되네요.

문제에서 matrix의 shape을 알 수 있고, matrix를 순회하는 과정에서 shape 정보만으로 순회를 할 수 있습니다. 이를 활용하면, 추가적인 메모리 사용 없이 문제를 풀 수 있습니다. 시간이 되신다면, 이 방법으로 풀어보셔도 좋을 것 같아요!

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

b8faa50
일단 공간 복잡도를 줄이기 위해 별도의 visit 배열을 제거하는 방식으로 수정해 보았습니다!

다만 현재는 방문 여부를 표시하기 위해 matrix의 값을 직접 변경하고 있고, 말씀해 주신 방법과도 조금 다른 것 같아 나중에 다시 고민해 봐야겠네요 ㅎㅎ

혹시 top, right, bottom, left 경계값을 설정한 뒤, 순회하면서 각 경계를 줄여 나가는 방식을 말씀하신 게 맞을까요? 👀

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.

음 아래의 이미지처럼, matrixmn을 구할 수 있고, 단순히 첫 번째 이동은 m만큼, 두번째 이동은 n만큼, 세 번째 이동은 m-1만큼...하는 것을 말한 것이었습니다

image

Copy link
Copy Markdown
Member Author

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.

N Log N 풀이법이 있습니다! 시도해 보시죠!

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

알려주셔서 감사합니다! 예전에 O(n log n) 풀이와 증명까지 공부했었는데, 지금은 로직만 기억나고 왜 그렇게 동작하는지는 잘 떠오르지 않아 우선 정석적인 O(n²) 풀이로 제출했습니다.

말씀해 주신 O(n log n) 방식도 다시 찾아보며 공부해 보겠습니다. 감사합니다! ☺️

Comment thread container-with-most-water/ICE0208.py

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, Depth-First Search, Backtracking
  • 설명: Trie를 활용한 단어 저장/검색 구조이며, '.' 와일드카드 처리 시 DFS로 모든 경로를 탐색한다. 백트래킹 성격의 재귀 호출로 모든 가능한 문자 조합을 확인하는 방식이다.

📊 시간/공간 복잡도 분석

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

🏷️ 알고리즘 패턴 분석

  • 패턴: Dynamic Programming
  • 설명: 코드에서 dp 배열로 각 위치를 끝으로 하는 최장 증가 부분수열 길이를 계산하는 전형적인 동적계획법(DP) 패턴으로, 이중 루프를 이용해 상태 전이를 구성합니다.

📊 시간/공간 복잡도 분석

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

피드백: 단순 DP 방식으로 구현되어 있지만 시간 복잡도가 n^2으로 비효율적일 수 있다.

개선 제안: 가능하면 이분 탐색을 통한 O(n log n) 풀이로 변경하는 것을 고려해볼 만하다.

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

Comment thread spiral-matrix/ICE0208.py

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, Monotonic Stack, Greedy
  • 설명: 해당 코드는 격자에서 한 방향으로 연속적으로 벽돌처럼 탐색하며, 방문 여부를 표시해 방향을 바꿔가며 나선 형태로 순회한다. 좌우상하로 방향을 전환하며 남은 미방문 칸을 따라가는 구조가 특징이다.

📊 시간/공간 복잡도 분석

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

🏷️ 알고리즘 패턴 분석

  • 패턴: Two Pointers, Stack/Deque (implicitly), Hash Map / Hash Set
  • 설명: 스택(Deque)으로 여는 괄호를 push하고, 닫는 괄호를 만났을 때 일치하는지 확인하는 방식으로 유효성 검사를 수행한다. 매칭 맵으로 괄등 비교를 하고, 전체 문자열을 한 번 순회한다.

📊 시간/공간 복잡도 분석

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

피드백: 스택 기반으로 각 문자에 대응하는 매핑을 확인하는 전형적인 풀이이다.

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

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

@ICE0208 ICE0208 moved this from Solving to In Review in 리트코드 스터디 8기 Aug 1, 2026

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

수고하셨습니다

left, right = 0, len(height) - 1

most_water_size = 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.

( ) 괄호는 붙이신 이유가 있을까요?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

아뇨 없습니다🤣 다른 언어랑 왔다갔다하니 무의식적으로 괄호로 감싼 것 같네요 ㅎㅎ

Comment thread spiral-matrix/ICE0208.py
answer.append(matrix[0][0])
setVisit(0, 0)
while len(answer) < total:
while inRange(i, j+1) and not isVisit(i, j+1):

@parkhojeong parkhojeong Aug 1, 2026

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.

in range 와 is visit 을 하나로 묶어서 함수로 추상화 해도 좋을 거 같습니다

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

그러네요! 좋은 의견 감사드립니다!!

Comment on lines +9 to +12
Map<Character, Character> mapping = new HashMap<>();
mapping.put(')', '(');
mapping.put('}', '{');
mapping.put(']', '[');

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.

Map.of 사용해서 선언시점에 할당해도 좋을 거 같아요

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

변경되지 않는 고정된 값이니 Map.of()를 사용해도 되겠네요. 알려주셔서 감사합니다!

@ICE0208
ICE0208 merged commit ce17a8d into DaleStudy:main Aug 1, 2026
1 check passed
@github-project-automation github-project-automation Bot moved this from In Review to Completed in 리트코드 스터디 8기 Aug 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Completed

Development

Successfully merging this pull request may close these issues.

4 participants