mirror of
https://github.com/autistic-symposium/master-algorithms-py.git
synced 2025-05-02 14:56:27 -04:00
Update and rename lowest_common_ancestor.py to bt_lowest_common_ancestor.py
This commit is contained in:
parent
ca5c15c9b6
commit
7520042ef9
1 changed files with 2 additions and 4 deletions
|
@ -2,12 +2,10 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# author: bt3gl
|
||||
|
||||
'''
|
||||
Given a binary tree, find the lowest common ancestor (LCA) of two given nodes in the tree.
|
||||
'''
|
||||
|
||||
class Tree:
|
||||
def lowest_common_ancestor(self, root: 'TreeNode', p: 'TreeNode', q: 'TreeNode') -> 'TreeNode':
|
||||
|
||||
def lowest_common_ancestor(self, root, p, q):
|
||||
|
||||
def dfs(root, p, q):
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue