Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SunaDu] Week 7 #935

Merged
merged 6 commits into from
Jan 25, 2025
Merged

[SunaDu] Week 7 #935

merged 6 commits into from
Jan 25, 2025

Conversation

dusunax
Copy link
Member

@dusunax dusunax commented Jan 21, 2025

답안 제출 문제

체크 리스트

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

@dusunax dusunax self-assigned this Jan 21, 2025
@dusunax dusunax requested a review from a team as a code owner January 21, 2025 06:02
@github-actions github-actions bot added the py label Jan 21, 2025
@dusunax dusunax requested a review from ekgns33 January 21, 2025 06:02
Copy link
Contributor

@ekgns33 ekgns33 left a comment

Choose a reason for hiding this comment

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

더미 노드를 하나 둬서 1루프로 풀이하셨군요 👍
리뷰와는 별개로 PR 제목이 잘못된 것 같습니다 😭

@dusunax dusunax closed this Jan 21, 2025
@dusunax dusunax reopened this Jan 21, 2025
@dusunax dusunax changed the title add solution: reverse-linked-list [SunaDu] - Week 7 Jan 21, 2025
@dusunax
Copy link
Member Author

dusunax commented Jan 21, 2025

더미 노드를 하나 둬서 1루프로 풀이하셨군요 👍 리뷰와는 별개로 PR 제목이 잘못된 것 같습니다 😭

넵 리뷰 감사합니다🥹 수정했습니다

def lengthOfLongestSubstring(self, s: str) -> int:
max_count = 0
start = 0
substrings = set() # SC: O(n)
Copy link
Contributor

@ekgns33 ekgns33 Jan 23, 2025

Choose a reason for hiding this comment

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

부분문자열에서 각 문자는 1회만 등장할 수 있다는 조건때문에 Set을 선택하셨군요. 👍
문자의 범위가 명확하게 정의되어 있다면 (e.g ASCII) 배열을 사용할 수도 있을 것 같아요!

아래 문제도 추가적으로 풀어보시면 sliding window 패턴을 익히시는데 도움이 될 것 같습니다
https://leetcode.com/problems/substring-with-concatenation-of-all-words

Copy link
Member Author

@dusunax dusunax Jan 23, 2025

Choose a reason for hiding this comment

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

ASCII코드 배열로 문자의 마지막 위치를 확인하는 방법이 있군요! 감사합니다

char_index = [-1] * 128 # SC: O(128)
for end in range(len(s)): # TC: O(n)
if char_index[ord(s[end])] >= start:
start = char_index[ord(s[end])] + 1
char_index[ord(s[end])] = end
max_count = max(max_count, end - start + 1)

추천해 주신 문제도 풀어보고 통과하면 댓글 달겠습니다😀

Copy link
Member Author

@dusunax dusunax Jan 26, 2025

Choose a reason for hiding this comment

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

@ekgns33
오래걸렸지만 추천해주신 문제 풀이해봤습니다🥹
permutation 경우를 변수에 저장했다가는 SC가 n!이 되는 점이 인상 깊었어요
슬라이딩 윈도우로 탐색할 때 어떤 데이터를 추적하는지 관련된 문제를 풀면서 예시를 많이 보면 좋겠다고 생각했습니다.

30. Substring with Concatenation of All Words

@dusunax dusunax mentioned this pull request Jan 24, 2025
10 tasks
Copy link
Contributor

@ekgns33 ekgns33 left a comment

Choose a reason for hiding this comment

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

고생하셨어요!

@TonyKim9401 TonyKim9401 merged commit 9f2e250 into DaleStudy:main Jan 25, 2025
1 check passed
@dusunax dusunax changed the title [SunaDu] - Week 7 [SunaDu] Week 7 Feb 6, 2025
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.

3 participants