Skip to content

[hwi-middle] WEEK 09 solutions#2584

Merged
hwi-middle merged 1 commit intoDaleStudy:mainfrom
hwi-middle:main
May 3, 2026
Merged

[hwi-middle] WEEK 09 solutions#2584
hwi-middle merged 1 commit intoDaleStudy:mainfrom
hwi-middle:main

Conversation

@hwi-middle
Copy link
Copy Markdown
Contributor

@hwi-middle hwi-middle commented May 3, 2026

답안 제출 문제

작성자 체크 리스트

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

🏷️ 알고리즘 패턴 분석

  • 패턴: Hash Map / Hash Set
  • 설명: 이 코드는 순회하면서 노드를 저장하는 해시셋을 사용하여 순환 여부를 판단하는 방식으로, 해시 맵 또는 해시 세트 패턴에 속합니다.

📊 시간/공간 복잡도 분석

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

피드백: The algorithm traverses each node once, inserting and checking nodes in a hash set, leading to linear time and space complexity.

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

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

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
  • 설명: 이 코드는 연속된 부분 배열의 최대 곱을 찾기 위해 이전 상태를 기반으로 최적의 값을 갱신하는 방식으로, 동적 프로그래밍 패턴에 속합니다.

📊 시간/공간 복잡도 분석

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

피드백: The solution processes each element once, updating max/min products, resulting in linear time and constant space complexity.

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

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

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.

🏷️ 알고리즘 패턴 분석

  • 패턴: Sliding Window, Hash Map / Hash Set
  • 설명: 이 코드는 슬라이딩 윈도우 기법으로 문자열 범위를 조절하며 조건을 만족하는 최소 구간을 찾는다. 해시 맵을 활용해 문자 등장 횟수와 조건 체크를 효율적으로 수행한다.

📊 시간/공간 복잡도 분석

복잡도
Time O(
Space O(

피드백: The algorithm expands and contracts the window efficiently, with each character visited at most twice, leading to linear time and space proportional to input sizes.

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

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

@dalestudy
Copy link
Copy Markdown
Contributor

dalestudy Bot commented May 3, 2026

📊 hwi-middle 님의 학습 현황

이번 주 제출 문제

문제 난이도 유형 분석
linked-list-cycle Easy ⚠️ 유형 불일치
maximum-product-subarray Medium ✅ 의도한 유형
minimum-window-substring Hard ✅ 의도한 유형
pacific-atlantic-water-flow Medium ✅ 의도한 유형
sum-of-two-integers Medium ⚠️ 유형 불일치

누적 학습 요약

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

문제 풀이 현황

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

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

🔢 API 사용량 (gpt-4.1-nano)
요청 입력 토큰 출력 토큰 합계 비용
1 2,765 193 2,958 $0.000354

@github-actions github-actions Bot added the c++ label May 3, 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.

🏷️ 알고리즘 패턴 분석

  • 패턴: BFS
  • 설명: 이 코드는 두 개의 큐를 이용한 너비 우선 탐색(BFS)을 통해 물이 흐를 수 있는 위치를 찾는 방식으로 문제를 해결합니다. BFS는 최단 거리 또는 레벨 탐색에 적합하며, 여기서는 인접한 위치를 차례로 탐색하는 데 사용됩니다.

📊 시간/공간 복잡도 분석

복잡도
Time O(r * c)
Space O(r * c)

피드백: Each cell is enqueued at most once per ocean, resulting in linear time and space complexity relative to grid size.

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

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

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
  • 설명: 이 코드는 비트 연산을 활용하여 두 정수의 합을 계산하는 방식으로, 비트 조작과 캐리 처리를 통해 덧셈을 수행하는 패턴입니다.

📊 시간/공간 복잡도 분석

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

피드백: The fixed number of bits ensures constant time and space complexity, as each bit is processed once.

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

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

@hwi-middle
Copy link
Copy Markdown
Contributor Author

@DaleStudy 리뷰해줘

@dalestudy
Copy link
Copy Markdown
Contributor

dalestudy Bot commented May 3, 2026

먼저, 여러 문제를 깔끔하게 해결책을 제출하신 점 정말 잘하셨습니다! 다양한 문제에 도전하며 코드의 품질과 접근법도 잘 유지하고 계시네요. 다음은 몇 가지 개선 포인트와 격려입니다.

  1. 시간/공간 복잡도 명시 요청
    각 솔루션에 시간과 공간 복잡도 분석이 포함되면 리뷰어가 이해하는 데 도움이 됩니다. 예를 들어, hasCycleTC: O(n), SC: O(n) (해시셋 사용), maxProductTC: O(n), SC: O(1) 등으로 명확히 해주세요.

  2. 가독성 및 스타일
    대부분의 코드는 깔끔하지만, 일부 변수명(ns, cur, temp_max, formed)은 조금 더 직관적인 이름으로 변경하면 가독성을 높일 수 있습니다. 예를 들어, nsvisitedNodes, curcurrentNode 등으로요.

  3. 중복 코드 최소화 및 효율적 구현
    hwi-middle.cpphasCycle은 해시셋을 사용하는 방법이 직관적입니다. 하지만, 시간복잡도를 고려할 때 Floyd’s Cycle Detection (slow/fast 포인터)을 사용하는 방법이 공간을 절약하는 좋은 대안입니다. 성능과 공간을 생각하면 추천드렸던 Floyd's 알고리즘도 고려해보세요.

  4. 알고리즘 개선 제안

    • maxProduct는 현재 O(n)으로 최적화되어 있으며, 잘 구현하셨습니다.
    • minWindow는 윈도우 크기 최소화 전략을 잘 사용했고, 구현도 깔끔합니다. 다만, dictT.contains(c)는 C++17 이상에서 지원하는 함수지만, 컴파일러 호환성을 위해 dictT.count(c)를 사용하는 것도 고려하세요.
  5. 코드 스타일 및 베스트 프랙티스
    대부분의 코드가 깔끔하지만, using namespace std;를 명시적으로 선언하거나, std:: 접두사를 일관되게 사용하는 것이 좋습니다. 또한, return 문 앞에 공백 또는 들여쓰기를 일관성 있게 유지하세요.

  6. 격려 메시지
    여러 문제를 자신만의 명확한 풀이로 잘 해결하셨고, 구조도 깔끔합니다. 앞으로도 다양한 알고리즘 도전과 함께 최적화와 가독성을 계속 신경 쓰시면 더욱 성장하실 겁니다. 계속해서 좋은 문제 해결 습관 유지하세요!

@hwi-middle
Copy link
Copy Markdown
Contributor Author

@DaleStudy 승인

Copy link
Copy Markdown
Contributor

@dalestudy dalestudy Bot left a comment

Choose a reason for hiding this comment

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

승인되었습니다! 👍

@hwi-middle hwi-middle merged commit 55c33fe into DaleStudy:main May 3, 2026
3 checks passed
@github-project-automation github-project-automation Bot moved this from In Review to Completed in 리트코드 스터디 7기 May 3, 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.

1 participant