标签:col 题目 bottom 运算 return ott public div 剑指offer
class Solution { public: int NumberOf1(int n) { int a = 1; int nums = 0; while (a != 0) { if (n == (n | a)) nums++; a <<= 1; } return nums; } };
标签:col 题目 bottom 运算 return ott public div 剑指offer
原文地址:https://www.cnblogs.com/ruoh3kou/p/10049152.html