王道机试对应章节
牛客网的题
poj的题
面试精心list中常问到的
最近公共祖先
//求二叉树某结点的最近公共父结点
#include<cstdio>
#include <string.h>
long long com(long long a,long long b){
if(a==b) return a;
else if(a>b) return com(a/2,b);
else return com(a,b/2);
}
int main(){
long long a,b;
while(scanf("%lld%lld",&a,&b)!=EOF){
printf("%lld\n",com(a,b));
}
return 0;
}
//
// Created by syx on 2019/6/7.
//
特殊题目
和一般求法