# -*- coding:utf-8 -*- class LCA: def getLCA(self, a, b): # write code here # 因为是按顺序排列的满二叉树,所以可以根据性质计算 while a != b: if a > b: a /= 2 else: b /= 2 return a