Skip to content
This repository was archived by the owner on Mar 18, 2024. It is now read-only.

[2023-08-11] jisu #96 #105

Merged
merged 1 commit into from
Aug 11, 2023
Merged

[2023-08-11] jisu #96 #105

merged 1 commit into from
Aug 11, 2023

Conversation

zsmalla
Copy link
Contributor

@zsmalla zsmalla commented Aug 9, 2023

PR Summary

풀이 시작 : 2023.08.09 13:03

  • 순서를 바꾸지 않아도 된다 -> 덧셈 뺄셈 연산자만 바꿔가며 경우의 수를 판단
  • 그리디한 접근은 어려울 것 같고(어차피 다 탐색해야함), 주어지는 수의 개수가 많지 않아서(20개) 완전탐색(dfs)으로 구현할 수 있을듯 함
  • 모든 수를 순서대로 탐색해야하므로 가지 치기는 없고, 그냥 부호만 바꿔가며 가지를 뻗어나가기만 하면 될 것 같다.

풀이 완료 : 2023.08.09 13:22

ISSUE NUMBER

@zsmalla zsmalla self-assigned this Aug 9, 2023
result = 0

def dfs(idx: int, numbers: List[int], target: int, total: int):
global result
Copy link
Contributor

Choose a reason for hiding this comment

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

오 바로 global 변수 result에 더해주셨군요 저는 이 부분을 별도로 구현했어요! global 쓰는게 더 깔끔할 것 같네용!


result = 0

def dfs(idx: int, numbers: List[int], target: int, total: int):
Copy link
Member

Choose a reason for hiding this comment

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

와 전 DFS는 어떻게 해야하나 고민하다가 BFS 풀이밖에 못했었는데 많은 인사이트를 가져갑니다. 아직 저는 그래프가 많이 부족하다는 것을 깨닫게 되었네요 ㅎㅎ 감사합니다 지수님!

@ksumini ksumini linked an issue Aug 11, 2023 that may be closed by this pull request
@Woo-Yeol Woo-Yeol merged commit 04cfa29 into main Aug 11, 2023
@Woo-Yeol Woo-Yeol deleted the jisu-#96 branch August 11, 2023 08:54
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Programmers] 타겟 넘버
3 participants