会员
周边
新闻
博问
闪存
赞助商
YouClaw
所有博客
当前博客
我的博客
我的园子
账号设置
会员中心
简洁模式
...
退出登录
注册
登录
GodWU
博客园
首页
新随笔
联系
管理
订阅
随笔分类 -
LeetCode OJ
LeetCode 190 Reverse Bits
摘要:解法1: 1 class Solution{ 2 public: 3 uint32_t reverseBits(uint32_t x){ 4 uint32_t res=0; 5 for (int i=0;i>i)&1)>1; } ...
阅读全文
posted @
2015-03-26 12:46
GodWU
阅读(146)
评论(0)
推荐(0)
LeetCode 191 Number of 1 Bits
摘要:LeetCode 191 Number of 1 Bits解法一(较为传统都解法):使用将n不断右移,并与1想&得到1的个数;(也有使用除法/2的,明显除法的运行效率要低于位移)时间复杂度:0(logn) 1 int hammingWeight(uint32_t n){ 2 int coun...
阅读全文
posted @
2015-03-14 11:58
GodWU
阅读(182)
评论(0)
推荐(0)
公告