알고리즘/알고리즘 문제 복기

LeetCode - 617. Merge Two Binary Trees

내일도무사히 2021. 2. 26. 23:50

leetcode.com/problems/merge-two-binary-trees/

 

Merge Two Binary Trees - 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

 

 

Answer

 

 

처음에는 output_node를 따로 만들어서 풀어보려 했지만 

NullPointerException때문에 계속해서 에러가 나는 바람에

 

기존의 root1을 변경하는 식으로 코드를 짰다.