[DaleSeo] WEEK 05 Solutions#2769
Open
DaleSeo wants to merge 1 commit into
Open
Conversation
Contributor
📊 DaleSeo 님의 학습 현황이번 주 제출 문제
누적 학습 요약
문제 풀이 현황
🤖 이 댓글은 GitHub App을 통해 자동으로 작성되었습니다. 🔢 API 사용량 (gpt-5-nano)
|
Contributor
There was a problem hiding this comment.
🏷️ 알고리즘 패턴 분석
- 패턴: Greedy, Dynamic Programming, Hash Map / Hash Set
- 설명: 문자열 인코딩/디코딩에서 각 문자열을 길이와 구분자로 표시하고 다시 파싱하는 방식은 명시적 기준에 의한 문자열 분리로 동작합니다. 길이-구분자 포맷 활용과 선형 순회로 구성된 로직은 Greedy 성격의 분할 처리에 해당합니다.
📊 시간/공간 복잡도 분석
ℹ️ 이 파일에는 2가지 풀이가 포함되어 있어 각각 분석합니다.
풀이 1: Solution.encode — Time: ✅ O(n) → O(n) / Space: ✅ O(n) → O(n)
| 유저 분석 | 실제 분석 | 결과 | |
|---|---|---|---|
| Time | O(n) | O(n) | ✅ |
| Space | O(n) | O(n) | ✅ |
피드백: 각 문자열의 길이와 문자열 내용을 '#' 문자 뒤에 붙여 하나의 문자열로 합친다. 이는 각 원소를 고유하게 구분하는 방식으로, 인코딩된 문자열의 길이는 모든 원소 길이 합과 구분자 개수에 비례한다.
개선 제안: 현재 구현이 적절해 보입니다.
풀이 2: Solution.decode — Time: O(n) / Space: O(n)
| 복잡도 | |
|---|---|
| Time | O(n) |
| Space | O(n) |
피드백: 숫자 길이만큼 슬라이싱 하여 각 원소를 재구성한다. 전체 길이에 비례하는 시간과 공간이 든다.
개선 제안: 현재 구현이 적절해 보입니다.
💡 풀이에 시간/공간 복잡도를 주석으로 남겨보세요!
parkhojeong
approved these changes
Jul 24, 2026
Comment on lines
+4
to
+8
| pub fn encode(strs: Vec<String>) -> String { | ||
| strs.iter() | ||
| .map(|s| format!("{}#{}", s.len(), s)) | ||
| .collect() | ||
| } |
Contributor
There was a problem hiding this comment.
Follow-up question까지 풀어보시면 좋을 거 같습니다!
Follow up: Could you write a generalized algorithm to work on any possible set of characters?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
답안 제출 문제
작성자 체크 리스트
In Review로 설정해주세요.검토자 체크 리스트
Important
본인 답안 제출 뿐만 아니라 다른 분 PR 하나 이상을 반드시 검토를 해주셔야 합니다!