阿里云实时计算平台事业部二面凉经
  前面就是围绕项目经历介绍。 
   其中涉及到一些技术点: 
   Docker的网络模式有哪些?分别介绍一下。 
   项目中遇到的比较困难的问题,怎么解决的,或者打算怎么解决? 
   Sidecar模式会对性能造成影响吗?有多少。 
   IO多路复用介绍一下。 
   其他记不太清了。 
   做题: 
   1. 第一道是一个求二进制串中的所有0的个数 
   这道题我没有啥好的思路,因为题目是二进制字符串,长度也不确定,然后就写了个暴力(虽然我知道他考得不是我这个)。 
   然后我说改成Integer类型的话,我可以求其中二进制中0的个数,提供了一个方法,就是不断地 做与运算,n &= (n-1),然后记录其中1的个数,直到n等于零,最后用32减去1的个数。 
   这题写的不好。 
 public class Main{
    public static long findZeroNumInBytes(byte[] bytes){
        long  cnt = 0 ;
        byte zero = '0';
        for(long i =0; i < bytes.length; i++){
            if( bytes[i] == zero){
                cnt++;
            }
        }
        return cnt;
    }
    
    public static long findZero(int x){
        int cnt = 0;
        for( ; x > 0; cnt++){
            x &= (x - 1);
        }
        return 32 - cnt;
    }
    
    public static void main(){
        String test = "101010101000000";
        System.out.println(findZeroNumInBytes(test.getBytes());
    }
}   2. 判断是否是二叉搜索树。 
   我做了个中序遍历,然后记录上一次的值,进行判断的,面试官说我右子树不对,给了我个样例来验证,我验证花了点时间没验证完就打断了我,说时间不多了,就看看我还有没有别的问题要问他的。 
 class Node { Integer val; Node left; Node right; } Integer last = Interger.minValue;
public static boolean isBinarySearchTree(Node root, Integer last){ if ( root == null ){ return true; } if(root.left != null){ boolean left = isBinarySearchTree(root.left, last); if(!left){ return false; } } if(last.val > root.val){ return false; } last = root.value; if(root.right != null){ boolean right = isBrinarySearchTree(root.right, last); if(!right){ return false; } } return true; }
  第二天收到邮件,挂了,二面凉了。 
 
