| 4 | import java.util.List; |
| 5 | |
| 6 | public class Sanghoo { |
| 7 | |
| 8 | // return 을 위한 인스턴스 변수 선언 |
| 9 | public List<Integer> res = new ArrayList<>(); |
| 10 | |
| 11 | public List<Integer> inorderTraversal(TreeNode root) { |
| 12 | if(root == null) return res; |
| 13 | |
| 14 | if(root.left != null) inorderTraversal(root.left); |
| 15 | res.add(root.val); // 중위 순회이므로 왼쪽 노드 체크 후 값 추가 |
| 16 | if(root.right != null) inorderTraversal(root.right); |
| 17 | |
| 18 | return res; |
| 19 | } |
| 20 | |
| 21 | } |
nothing calls this directly
no outgoing calls
no test coverage detected