일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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
- 715. Range Module
- 프로그래머스
- t1
- Substring with Concatenation of All Words
- shiba
- Python
- Convert Sorted List to Binary Search Tree
- 시바견
- iterator
- Python Code
- attribute
- 파이썬
- Class
- data science
- 30. Substring with Concatenation of All Words
- LeetCode
- 운영체제
- 컴퓨터의 구조
- Protocol
- 109. Convert Sorted List to Binary Search Tree
- concurrency
- Regular Expression
- 315. Count of Smaller Numbers After Self
- 43. Multiply Strings
- 밴픽
- kaggle
- Generator
- DWG
- Decorator
- Python Implementation
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