def lowestCommonAncestor(self, root, A, B):
        """
        O(n) for find path

        ...>LCA***>A
        ...>LCA####>B
        Any node on two paths before LCA are equal respectively
        Any node on two paths after LCA are different respectively

        1. get the paths from root to A and from root to B
        2. cut longer path's tail to make two equal length
        3. scan backward to find the first common ancestor

        :type root: TreeNode
        :type A: TreeNode
        :type B: TreeNode
        :param root: The root of the binary search tree.
        :param A: node in a Binary.
        :param B: node
        :return: Return the least common ancestor(LCA) of the two nodes.
        """
        p1 = self.path(root, A)
        p2 = self.path(root, B)
        p1.append(TreeNode(0))  # dummy
        p2.append(TreeNode(0))  # dummy
        for ind, val in enumerate(p1):
            if val != p2[ind]:
                return p1[1-ind]
dataset/ETHPy150Open algorhythms/LintCode/Lowest Common Ancestor.py/Solution.lowestCommonAncestor/swapped operands of `-`