Invert Binary Tree
Binary Tree(이진트리) 의 node와 그 node의 children을 invert 하는 문제. node뿐 아니라 그 밑에 속해있는 자식들까지 swipe해야하기때문에 recursive function(재귀함수)을 사용해야한다. Solution 1 var invertTree = function(root) { //재귀의 정지값->root가 있을때 까지. if(root){ swap(root); //swipe children invertTree(root.left); //subtree의 children에게도 같은 process적용을 위해 recursive invertTree(root.right); } return root; }; var swap = function(root){ let left = root...
Algorithms
2020. 11. 30. 22:51
공지사항
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
링크
TAG
- 프로그래머스
- easy algorithm
- repeat()
- compareTo()
- algorithm
- rest parameter
- HackerRank Algorithm
- equals()
- spring boot application
- hackerrank javascript solution
- 알고리즘
- ... in Javascript
- code refactoring
- math.max
- string class in java
- 프로그래머스 알고리즘
- Object type casting
- Collection Framework
- hackerrank
- java
- javascript
- hackerrank javascript
- HashMap
- 프로그래머스 알고리즘문제
- Javascript Algorithm
- C++
- substring()
- hackerrank solution
- easy javascript algorithm
- math.abs
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 |
글 보관함