일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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
- 715. Range Module
- t1
- kaggle
- 시바견
- 109. Convert Sorted List to Binary Search Tree
- Generator
- 밴픽
- Python Code
- iterator
- DWG
- Python Implementation
- concurrency
- Class
- 컴퓨터의 구조
- 프로그래머스
- 파이썬
- attribute
- LeetCode
- 운영체제
- Protocol
- shiba
- 43. Multiply Strings
- Python
- Regular Expression
- data science
- Decorator
- Convert Sorted List to Binary Search Tree
- 30. Substring with Concatenation of All Words
- Substring with Concatenation of All Words
- 315. Count of Smaller Numbers After Self
Archives
- Today
- Total
목록236. Lowest Common Ancestor of a Binary Tree (1)
Scribbling
LeetCode: 236. Lowest Common Ancestor of a Binary Tree
코드가 너무 복잡하다. # Definition for a binary tree node. # class TreeNode: # def __init__(self, x): # self.val = x # self.left = None # self.right = None class Solution: def lowestCommonAncestor(self, root: 'TreeNode', p: 'TreeNode', q: 'TreeNode') -> 'TreeNode': self.ret = None self.dfs(root, p, q) return self.ret def dfs(self, node, p, q): if node == None: return None l = self.dfs(node.left, p, q) if..
Computer Science/Coding Test
2021. 12. 15. 22:43