일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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
- Python
- 43. Multiply Strings
- kaggle
- 시바견
- data science
- iterator
- Substring with Concatenation of All Words
- Regular Expression
- Convert Sorted List to Binary Search Tree
- shiba
- Decorator
- 컴퓨터의 구조
- DWG
- Class
- t1
- 운영체제
- Python Implementation
- LeetCode
- 프로그래머스
- 밴픽
- 109. Convert Sorted List to Binary Search Tree
- 30. Substring with Concatenation of All Words
- attribute
- Protocol
- 315. Count of Smaller Numbers After Self
- Python Code
- 파이썬
- Generator
- 715. Range Module
- concurrency
Archives
- Today
- Total
목록Find Leaves of Binary Tree (1)
Scribbling
LeetCode: 366. Find Leaves of Binary Tree
# Definition for a binary tree node. # class TreeNode: # def __init__(self, val=0, left=None, right=None): # self.val = val # self.left = left # self.right = right class Solution: def findLeaves(self, root: Optional[TreeNode]) -> List[List[int]]: self.ret = [] self.dfs(root) return self.ret def dfs(self, node): if node.left and node.right: h = max(self.dfs(node.left), self.dfs(node.right)) + 1 e..
Computer Science/Coding Test
2022. 2. 2. 17:34