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 |
Tags
- vue.js
- 머신러닝
- BFS
- 도커
- k8s
- 생성형 AI
- Machine Learning
- 쿠버네티스
- vuejs
- 로깅
- Redis
- 컨설턴트
- 컨설팅
- 오픈시프트
- kubernetes
- 메세지큐
- LeetCode
- 리트코드
- OpenShift
- Python
- fastapi
- 생성형
- SpringBoot
- GPT
- POD
- 솔루션조사
- fast api
- jpa
- LLaMa
- Docker
Archives
- Today
- Total
수 많은 우문은 현답을 만든다
(Easy) Maximum Depth of Binary Tree 본문
Given the root of a binary tree, return its maximum depth.
A binary tree's maximum depth is the number of nodes along the longest path from the root node down to the farthest leaf node.
Example 1:
Input: root = [3,9,20,null,null,15,7]
Output: 3
Example 2:
Input: root = [1,null,2]
Output: 2
풀이
더보기
if not root:
return 0
left = self.maxDepth(root.left)
right = self.maxDepth(root.right)
return max(left, right) + 1
'코딩테스트 > Tree' 카테고리의 다른 글
(Medium) 허프만 코딩 (0) | 2023.11.06 |
---|---|
(Medium) BST 여부 검증 (0) | 2023.10.26 |
(Medium) BST LCA 구하기 (0) | 2023.10.26 |
(Easy) 트리 높이 구하기 (0) | 2023.10.24 |
(Easy) Invert Binary Tree (0) | 2023.06.18 |