![](https://img1.daumcdn.net/thumb/R750x0/?scode=mtistory2&fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FJMrlz%2FbtsMnY8JSPW%2FRZLyMikAZzyDFVVStgT0I0%2Fimg.png)
[LeetCode] 226. Invert Binary Tree, Easy![](https://tistory1.daumcdn.net/tistory_admin/blogs/image/category/new_ico_5.gif)
![](https://tistory1.daumcdn.net/tistory_admin/blogs/image/category/new_ico_5.gif)
·
CodingTest/LeetCode
1. 문제 이진 트리가 주어질 때, 각 자식 노드들을 좌우반전 시켜서 root node를 반환하라.완전 이진 트리가 아님에 주의, 자식 노드가 1개인 경우도 고려해야 한다.2. 해결/** * Definition for a binary tree node. * class TreeNode { * val: number * left: TreeNode | null * right: TreeNode | null * constructor(val?: number, left?: TreeNode | null, right?: TreeNode | null) { * this.val = (val===undefined ? 0 : val) * this.left = (left===..