Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 | 31 |
Tags
- matrix
- two pointers
- 쉬움
- 문자열
- binary tree
- 리트코드
- DP
- Array
- easy
- linked list
- tree
- string
- 미디움
- dfs
- binary search
- 이진트리
- list
- backtracking
- Python
- 재귀
- hash table
- math
- sorting
- Depth-first Search
- leetcode
- HashTable
- 중간
- Binary
- recursive
- Medium
Archives
- Today
- Total
목록Depth-Frist Search (1)
부부의 코딩 성장 일기
LeetCode 110(Balanced Binary Tree, Python)
1. 문제 링크 https://leetcode.com/problems/balanced-binary-tree/ 2. 문제 설명 이진트리가 주어질 때, 이 트리가 height-balanced 되있는지에 따른 boolean을 반환 height-balanced의 정의 모든 노드의 두개의 subtree의 depth가 1개보다 더 차이나지 않는 이진트리 예시1) 아래 트리의 경우 루트 노드 3에 대해 subtree의 depth가 왼쪽 오른쪽 각각 1, 2이고 노드 9는 0,0, 노드 20은 각각 1,1로 depth가 1보다 더 차이나는 게 없으므로 True를 반환 3 / \ 9 20 / \ 15 7 예시2) 아래 트리의 경우 루트노드 1에 대해 subtree의 depth가 왼쪽 3, 오른쪽 1이기 때문에 1보다 더..
카테고리 없음
2023. 11. 19. 19:00