본문 바로가기
캐나다 개발자

Algorithms - Cut the tree DFS

by 아임투데이 2022. 2. 15.
반응형

https://www.hackerrank.com/challenges/cut-the-tree/problem

 

Cut the Tree | HackerRank

Remove an edge from a tree such that the sum of the absolute difference between the value stored at each of the trees' vertices is minimal.

www.hackerrank.com

참고 : https://power-coding.tistory.com/7

 

[문제 풀이] Hacker Rank - Cut the Tree

HackerRank link Cut the Tree 풀이 핵심 node의 탐색 방법으로는 DFS를 이용. node를 탐색하면서 노드의 값을 더하면서 값을 계산함. 이 문제 에서 Java의 경우 input reference 코드의 퍼포먼스가 매우 안좋게..

power-coding.tistory.com

Cut the Tree / Medium / DFS

 

반응형