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

[thispath98] Week 6 #895

Merged
merged 3 commits into from
Jan 19, 2025
Merged

[thispath98] Week 6 #895

merged 3 commits into from
Jan 19, 2025

Conversation

thispath98
Copy link
Contributor

@thispath98 thispath98 commented Jan 13, 2025

답안 제출 문제

Week 5 문제들을 PR 하지 못해서 부득이하게 이번주에 포함시켰습니다.

Week 5

Week 6

체크 리스트

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

@thispath98 thispath98 requested a review from a team as a code owner January 13, 2025 05:12
@github-actions github-actions bot added the py label Jan 13, 2025
@thispath98 thispath98 requested a review from KwonNayeon January 13, 2025 05:13
Copy link
Contributor

Choose a reason for hiding this comment

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

아하핳... 저도 처음에 이렇게 풀었었는데, 문제에 숨은 의도를 좀 더 파악해 보는것도 괜찮을것 같아요!

Comment on lines +31 to +34
if stack:
return False
else:
return True
Copy link
Contributor

Choose a reason for hiding this comment

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

return 시 stack의 사이즈를 비교하는 걸로 하면 한줄로 줄일 수 있을것 같아요!

Copy link
Contributor

@TonyKim9401 TonyKim9401 left a comment

Choose a reason for hiding this comment

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

5, 6주차 문제 풀이 고생 많으셨습니다.
문제 올리는 것에 관계 없이 꾸준히 풀어주시는 모습에 감사드리고 도움이 되셨으면 좋겠습니다.
절반 정도의 기간 동안 고생 많으셨고 남은 8주도 파이팅입니다!

Comment on lines +17 to +34
stack = []
for ch in s:
if ch in ["(", "{", "["]:
stack.append(ch)
elif ch in [")", "}", "]"]:
if stack and (
(ch == ")" and stack[-1] == "(")
or (ch == "}" and stack[-1] == "{")
or (ch == "]" and stack[-1] == "[")
):
stack.pop()
else:
return False

if stack:
return False
else:
return True
Copy link
Contributor

Choose a reason for hiding this comment

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

코드가 직관적이라 이해하기 쉬웠습니다! 딕셔너리를 활용하여 코드를 조금 더 간결하게 개선할 수 있을 것 같습니다.

Comment on lines +3 to +10
class Solution:
def groupAnagrams(self, strs: List[str]) -> List[List[str]]:
anagram_dict = defaultdict(list)
for string in strs:
anagram_dict[tuple(sorted(string))].append(string)

answer = list(anagram_dict.values())
return answer
Copy link
Contributor

@KwonNayeon KwonNayeon Jan 18, 2025

Choose a reason for hiding this comment

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

리뷰가 늦어져서 죄송합니다. 저는 if-else문을 활용해서 키가 존재하는지의 여부를 체크했는데, defaultdict(list)를 사용하면 예외처리를 더 간단하게 할 수 있다는 걸 알게 됐습니다! 이번 주도 고생하셨습니다!

@SamTheKorean SamTheKorean merged commit 8be8ae2 into DaleStudy:main Jan 19, 2025
1 check passed
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