Update and rename lowest_common_ancestor.py to bt_lowest_common_ancestor.py

This commit is contained in:
marina 2023-08-03 13:18:31 -07:00 committed by GitHub
parent ca5c15c9b6
commit 7520042ef9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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):