《劍指offer》學習筆記_面試題15_二進制中1的個數

    1.解法1 int NumberOf1(int n){ int count = 0; unsigned int flag = 1; while(flag){//當flag中的1移到越界後,flag值會轉變爲0 //當n&flag不爲0時,表示當前flag中1對應的位置不爲0 if(n&flag)
相關文章
相關標籤/搜索