[剑指offer刷题 --- 21] 二进制中1的个数

1. 基本思路code int Number1(int n) { int count = 0; while (n != 0) { if (n % 2 == 1) count = count + 1; n = n / 2; } return count; } 当n为正数时,上述方法有效,但当n为负数时,上述结果没
相关文章
相关标签/搜索