Simpler solution to find lower common ancestor