Skip to content

Conversation

@suhwan2004
Copy link
Collaborator

문제

Type Info
Time Complexity O(N)
Space Complexity O(N)
Algorithm dfs
Data Structure Tree

Constraints

  • 트리 노드들의 갯수는 0개에서 5000개 사이
  • -1000 <= Node.val <= 1000
  • -1000 <= targetSum <= 1000

Edge Case

root가 없을 시에 바로 false

풀이

root부터 시작하여 dfs를 돌며 모든 구간 합을 구한다.
=> 이 과정에서 구간합이 targetSum이 있다면 true를 반환한다.

어려웠던 점

X

알게된 점

X

@suhwan2004 suhwan2004 self-assigned this Dec 30, 2024
@github-actions github-actions bot enabled auto-merge (squash) January 7, 2025 01:25
@github-actions github-actions bot merged commit 340abc6 into main Jan 7, 2025
2 checks passed
@BangDori BangDori deleted the suhwan2004/path-sum branch January 7, 2025 01:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants