摘要: 1. n & (n - 1) 运算结果恰为把n的二进制位中的最低位的1变为0之后的结果,可用来计算位1的个数。 public class Solution { public int hammingWeight(int n) { int ret = 0; while (n != 0) { n &= n 阅读全文
posted @ 2022-04-05 22:42 hunter-w 阅读(23) 评论(0) 推荐(0) 编辑