Skip to content

[Chaedie] Week 11 #1032

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

Merged
merged 6 commits into from
Feb 22, 2025
Merged

[Chaedie] Week 11 #1032

merged 6 commits into from
Feb 22, 2025

Conversation

Chaedie
Copy link
Contributor

@Chaedie Chaedie commented Feb 17, 2025

답안 제출 문제

체크 리스트

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

@Chaedie Chaedie requested a review from a team as a code owner February 17, 2025 00:19
@github-actions github-actions bot added the py label Feb 17, 2025
@Chaedie Chaedie requested a review from mike2ox February 17, 2025 00:20
Copy link
Contributor

@HC-kang HC-kang left a comment

Choose a reason for hiding this comment

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

@Chaedie 님, 11주차도 고생하셨습니다.
코드가 참 예쁘네요 ㅋㅋ 이런게 파이써닉 한거구나 싶습니다!


class Solution:
def validTree(self, n: int, edges: List[List[int]]) -> bool:
if not n:
Copy link
Contributor

Choose a reason for hiding this comment

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

이 문제에는 트리의 성질을 이용한 조기종료 조건이 하나 더 숨어있어요.
시간이 괜찮으시다면 한번 찾아보시는것도 좋을 것 같습니다!

그리고 이 문제만 복잡도 분석이 빠져있는데, 혹시 빠뜨리신걸까 해서 말씀드려요!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

감사합니다.. ! 다른 분들 코드 참고를 많이 해서 예뻐진것 같습니다.. 😀

if len(edges) != n - 1: return False
  1. 간선의 갯수 < 노드 갯수 - 1 일 경우 연결되지 않은 그래프
  2. 간선의 갯수 > 노드 갯수 - 1 일 경우 순환이 있는 그래프

라는 조기 종료 조건이 있네요..! 감사합니다.

Copy link
Contributor

@mike2ox mike2ox left a comment

Choose a reason for hiding this comment

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

고생하셨습니다! 확실히 파이썬이 다른 언어들에 비해 알고리즘 문제 풀 때 간결하게 완성하기 좋네요. 다음주도 화이팅입니다! 👍

# Please enter a commit message to explain why this merge is necessary,
# especially if it merges an updated upstream into a topic branch.
#
# Lines starting with '#' will be ignored, and an empty message aborts
# the commit.
@Chaedie Chaedie merged commit a7b1113 into DaleStudy:main Feb 22, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
No open projects
Status: Completed
Development

Successfully merging this pull request may close these issues.

3 participants