Skip to content

Conversation

jinah92
Copy link
Contributor

@jinah92 jinah92 commented Dec 27, 2024

답안 제출 문제

체크 리스트

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

@jinah92 jinah92 requested a review from a team as a code owner December 27, 2024 02:26
@github-actions github-actions bot added the py label Dec 27, 2024
@jinah92 jinah92 requested a review from mmyeon December 27, 2024 02:27
Copy link
Contributor

@mmyeon mmyeon left a comment

Choose a reason for hiding this comment

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

저는 타입스크립트를 주로 사용해서, 파이썬 코드는 처음인데요. 😄
변수명과 로직 모두 의도가 드러나게 작성해주셔서 쉽게 이해할 수 있었어요. 덕분에 많이 배웠습니다 👍
3주차 고생 많으셨고, 4주차도 파이팅입니다!

@@ -0,0 +1,19 @@
# O(T) time, O(C^T) space
Copy link
Contributor

Choose a reason for hiding this comment

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

시간 복잡도와 공간 복잡도가 서로 바뀐 것 같은데 확인 부탁드려요!
시간 복잡도는 각 candidate마다 dfs 호출하고 있어서 O(C^T)되고, 공간 복잡도는 호출 스택의 깊이에 비례하니까 O(T)로 되어야 할 것 같아요~

Comment on lines +11 to +12
tmp_sum = num_set[idx]
result = max(result, tmp_sum)
Copy link
Contributor

Choose a reason for hiding this comment

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

tmp_sum에서 값 저장해서 사용하는데 변수없이 바로 참조해서 사용할 수 있을 것 같아요.
result = max(result, num_set[idx])

Comment on lines +13 to +17
elif zero_total == 1:
if num == 0:
result.append(non_zero_product)
else:
result.append(raw_product)
Copy link
Contributor

Choose a reason for hiding this comment

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

질문이 있습니다! raw_product 변수는 항상 0이 되지 않을까요?
지금 조건문이 0이 배열에서 1개만 존재하는 경우,
자기 자신이 0이면 => 0이 아닌 숫자 곱 추가
자기 자신이 0이 아니면 => 다른 숫자가 0이니까 곱이 항상 0

이렇게 이해했고, 그러면 변수 없이 그냥 result.append(0) 추가해도 충분할 것 같아서요!

@SamTheKorean SamTheKorean merged commit f811d45 into DaleStudy:main Dec 29, 2024
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