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