Skip to content

[essaysir] WEEK 01 Solutions#2648

Merged
essaysir merged 5 commits into
DaleStudy:mainfrom
essaysir:main
Jun 27, 2026
Merged

[essaysir] WEEK 01 Solutions#2648
essaysir merged 5 commits into
DaleStudy:mainfrom
essaysir:main

Conversation

@essaysir

@essaysir essaysir commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

답안 제출 문제

작성자 체크 리스트

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

검토자 체크 리스트

Important

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

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

@dalestudy

dalestudy Bot commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

📊 essaysir 님의 학습 현황

이번 주 제출 문제

문제 난이도 유형 분석
contains-duplicate Easy ✅ 의도한 유형
house-robber Medium ✅ 의도한 유형
longest-consecutive-sequence Medium ⚠️ 유형 불일치
top-k-frequent-elements Medium ⚠️ 유형 불일치
two-sum Easy ⚠️ 유형 불일치

누적 학습 요약

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

문제 풀이 현황

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

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

🔢 API 사용량 (gpt-4.1-nano)
요청 입력 토큰 출력 토큰 합계 비용
1 608 69 677 $0.000088
2 608 68 676 $0.000088
3 1,432 139 1,571 $0.000199
4 1,776 172 1,948 $0.000246
합계 4,424 448 4,872 $0.000622

@njngwn njngwn self-requested a review June 22, 2026 20:02
sonjs7554 and others added 3 commits June 25, 2026 09:20
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

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
  • 설명: 이 코드는 중복 여부를 빠르게 확인하기 위해 HashSet을 사용하여 각 요소를 저장하며, 이미 존재하는지 여부를 체크하는 방식입니다. 따라서 해시 맵 또는 해시 세트 패턴에 속합니다.

📊 시간/공간 복잡도 분석

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

피드백: Set에 모든 원소를 저장하며, 중복 검사 시 add 실패 여부로 판단한다. 시간과 공간 모두 입력 크기에 비례한다.

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

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

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 패턴에 속합니다.

📊 시간/공간 복잡도 분석

복잡도
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.

🏷️ 알고리즘 패턴 분석

  • 패턴: Sorting
  • 설명: 이 코드는 배열을 정렬한 후 연속된 수의 길이를 찾기 위해 순차적으로 탐색하는 방식으로, 정렬이 핵심 알고리즘입니다.

📊 시간/공간 복잡도 분석

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

피드백: 배열 정렬이 시간 복잡도를 결정하며, 정렬 후 한 번 순회하여 최대 연속 길이를 찾는다.

개선 제안: 정렬 대신 해시셋을 이용하면 시간 복잡도를 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.

🏷️ 알고리즘 패턴 분석

  • 패턴: Hash Map / Hash Set, Heap / Priority Queue
  • 설명: 이 코드는 각 숫자의 빈도수를 HashMap으로 세고, 우선순위 큐(힙)를 사용해 상위 k개를 찾는 방식으로 구성되어 있습니다. 따라서 해시 맵과 힙 패턴이 적용됩니다.

📊 시간/공간 복잡도 분석

유저 분석 실제 분석 결과
Time O(n log n) O(n log k)
Space O(n) O(n)

피드백: 빈도수 계산은 O(n), 힙 연산은 k개에 대해 수행되어 전체 시간은 O(n log k)이다. 공간은 해시맵과 힙에 비례한다.

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

Comment thread two-sum/essaysir.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.

🏷️ 알고리즘 패턴 분석

  • 패턴: Brute Force
  • 설명: 이 코드는 모든 가능한 쌍을 탐색하는 방식으로 문제를 해결하며, 명시적 패턴 목록에는 없지만 가장 기본적인 탐색 방법인 Brute Force에 해당합니다.

📊 시간/공간 복잡도 분석

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

피드백: 모든 쌍을 검사하는 방식으로, 시간 복잡도는 입력 크기의 제곱이다. 공간은 상수이다.

개선 제안: 해시맵을 이용한 방법으로 시간 복잡도를 O(n)으로 개선할 수 있다.

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

@essaysir essaysir moved this from Solving to In Review in 리트코드 스터디 8기 Jun 26, 2026
@DaleSeo

DaleSeo commented Jun 26, 2026

Copy link
Copy Markdown
Member

@essaysir #2648 (comment)

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

수고하셨습니다!

// SC: O(n)
public int longestConsecutive(int[] nums) {
// 연속적인 수의 개수를 구한다.
Arrays.sort(nums);

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.

Arrays.sort()의 시간복잡도는 O(nlogn) 이라서, 결국 전체 시간 복잡도는 O(nlogn)으로 봐야할 것 같습니다!

import java.util.*;

class Solution {
// TC: O(n log 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.

시간 복잡도를 수정해야할 것 같습니다.

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 thread two-sum/essaysir.java
int[] result = new int[2];
for ( int i = 0; i < nums.length; i++){
for ( int j = i + 1; j < nums.length; j++){
if ( target == nums[i] + nums[j]){

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.

정답을 찾았을 경우엔, break를 줘서 불필요하게 for 문을 돌지 않게 해도 좋을 것 같습니다

@essaysir essaysir merged commit f62eee4 into DaleStudy:main Jun 27, 2026
1 check passed
@github-project-automation github-project-automation Bot moved this from In Review to Completed in 리트코드 스터디 8기 Jun 27, 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.

4 participants