diff --git a/trees/lowest_common_ancestor.py b/trees/bt_lowest_common_ancestor.py similarity index 72% rename from trees/lowest_common_ancestor.py rename to trees/bt_lowest_common_ancestor.py index eebb9f6..fdc1a1f 100644 --- a/trees/lowest_common_ancestor.py +++ b/trees/bt_lowest_common_ancestor.py @@ -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):