JAVA方向笔试强训-day11

 一.编程题

最近公共祖先_牛客题霸_牛客网 (nowcoder.com) 

public class LCA {
  public int getLCA(int a, int b) {
    // write code here
    while(a!=b){
      if(a>b){
        a/=2;
     }else{
        b/=2;
     }
   }
    return a;
 }
}

 求最大连续bit数_牛客题霸_牛客网 (nowcoder.com)

1的二进制位数:0001 

假设输入的数字是3:00000011

你可能感兴趣的:(JAVA方向48天笔试强训,java,算法,蓝桥杯)