Leetcode 338 Counting Bits
来源:互联网 发布:淘宝运营助理工资 编辑:程序博客网 时间:2024/06/17 02:21
Leetcode 338 Counting Bits
#include <vector>#include <intrin.h>//__popcnt#include<nmmintrin.h>using namespace std;class Solution {public: vector<int> countBits(int num) { vector<int> bitsNum; for (int i = 0; i <= num; i++){ int count = 0; /*while (i){ i = i &(i - 1); count++; }*/ //__builtin_popcount(i);gcc的内建函数,计算一个32位无符号整数有多少位为1 //count = __popcnt(i);//vs情况下,MSVC count = _mm_popcnt_u32(i); bitsNum.push_back(count);// SSE4 Streaming SIMD Extensions 4, intel处理器继承指令集的一个版本 } return bitsNum; }};
阅读全文
0 0
- leetcode:bits:Counting Bits(338)
- 【LeetCode-338】Counting Bits
- leetcode-338-Counting Bits
- Leetcode 338 Counting Bits
- LeetCode 338 :Counting Bits
- [leetcode-338]Counting Bits
- 【LeetCode-338】 Counting Bits
- LeetCode 338 Counting Bits
- Counting Bits leetcode 338
- [LeetCode 338] Counting Bits
- LeetCode-338:Counting Bits
- LeetCode-338:Counting Bits
- LeetCode[338] Counting Bits
- LeetCode#338 Counting Bits
- LeetCode 338 Counting Bits
- LeetCode 338 Counting Bits
- Leetcode #338 Counting Bits
- Leetcode 338 Counting Bits
- 仿金融APP收益曲线图
- HDU5926-Mr. Frog’s Game
- Python笔记3-python基础2
- 达林顿电路分析
- 针对移动机器人的人体目标检测和跟踪系统的实现
- Leetcode 338 Counting Bits
- android注解的基本原理和使用
- C++中函数重载
- Leetcode 342 Power of Four
- 测试TensorFlow Object Detection API
- 欢迎使用CSDN-markdown编辑器
- JDBC之第一个较为规范的JDBC程序
- Leetcode 461 Hamming Distance
- POJ 3252 数位DP 解题报告