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