leetcode-位运算

版权声明:此文章为许诗宇所写,如需转载,请写下转载文章的地址 https://blog.csdn.net/xushiyu1996818/article/details/83141794

leetcode-191-位1的个数(number of one bits)-java
与1与运算,为1为奇数,为0位偶数
之后n>>2,相当于/2
将>>改为>>>因为>>如果全为1(也就是-1)的话0不会填位,而>>>会

猜你喜欢

转载自blog.csdn.net/xushiyu1996818/article/details/83141794
今日推荐