网页学习体会

  • 首页
  • 个人博客
您的位置: 首页  >  IT文章  >  leetcode-剑指15-OK

leetcode-剑指15-OK

分类: IT文章 • 2023-12-04 12:00:01

language: C

address

// 除就完了
int hammingWeight(uint32_t n) {
    uint32_t a =2;
    uint32_t yu;
    int ans = 0;
    for(int i = 0;i < 32; i++){
        yu = n%a;
        if(yu ==1)
            ans++;
        n = n/a;
    }
    return ans;
}

相关推荐

  • 剑指Offer系列之题46~题50
  • 剑指Offer系列之题61~题67(完结)
  • 剑指Offer系列之题51~题55
  • 剑指offer-11-二进制中1的个数
  • 剑指offer-06-旋转数组的最小数字
  • 剑指offer-10-矩形覆盖
  • 剑指offer-05-用两个栈实现队列
  • 剑指offer-09-跳台阶
  • 剑指offer-字符串转为int数字,不用+来相加两个数,不用新增变量来交换数,在递增序列中找和为s的两个数字and找和为s的序列。 字符串转为int数字 不用+来相加两个数 PS.不用新增变量来交换数 在递增序列中找和为s的两个数字and找和为s的序列。
  • 剑指offer-在一维数组中找重复出现的数。
  • Pass additional arguments during initialization and/or construction
  • TP复习11
    网站免责声明 网站地图 最新文章 用户隐私 版权申明
本站所有数据收集于网络,如果侵犯到您的权益,请联系网站进行下架处理。   

Copyright © 2018-2021   Powered By 网页学习体会    备案号:   粤ICP备20002247号