112
-
[LeetCode] 112. Path SumLeetCode 2021. 10. 18. 00:24
https://leetcode.com/problems/path-sum/ Path Sum - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com Path Sum Path Sum 시리즈 첫번째다. 이진 트리가 주어졌을때, 루트 노드부터 마지막 노드까지 더해 targetSum이 하나라도 나오는지 출력하는 문제다. 풀이는 루트 노드부터 자식 노드들을 쭉 방문하면서 해당 노드의 값을 부모노드+해당노드 의 값으로 업데이트를 해준다. 그리고 left, right 자식이 없을 경우..