知识点 1. java中int和binary之间互相转换的自带函数 2. int的最大值是231-1,用二进制表示就是有31个1,int有32位,第一位是表示符号,java中没有unsigned int,如果有的话是32位 这题用string的方法做是: 不用考虑溢出的情况,因为unsigned i ...
分类:
其他好文 时间:
2016-07-21 06:27:01
阅读次数:
289
Given two 32-bit numbers, N and M, and two bit positions, i and j. Write a method to set all bits between i and j in N equal to M (e g , M becomes a s ...
分类:
其他好文 时间:
2016-07-20 06:31:45
阅读次数:
249
mysql字符集 字符集基础 字符集:数据库中的字符集包含两层含义 字符集分类: ASCII:美国信息互换标准编码;英语和其他西欧语言;单字节编码,7位(bits)表示一个字符,共128字符。 GBK:汉字内码扩展规范;中日韩汉字、英文、数字;双字节编码;共收录了21003个汉字,GB2312的扩展 ...
分类:
数据库 时间:
2016-07-19 23:20:59
阅读次数:
394
参考http://www.hawstein.com/posts/5.1.html 方案1:先将N中第0位到第i位保存下来(左闭右开:[0, i)),记作ret, 然后将N中第0位到第j位全清0([0, j]),通过向右移动j+1位然后再向左移动j+1位得到。 最后用上面清0后的值或上(m«i)再或上 ...
分类:
其他好文 时间:
2016-07-19 13:34:42
阅读次数:
116
Note:1) * 2 is same as << 1, so the number contains only one bit that is 1, the rest of bits are 0. 2) n-1 sets all the bits after bit 1 from 0 to 1, ...
分类:
其他好文 时间:
2016-07-19 13:14:32
阅读次数:
188
338. Counting Bits
Given a non negative integer number num. For every numbers i in the range 0 ≤ i ≤ num calculate the number of 1's in their binary representation and
return them as an array...
分类:
其他好文 时间:
2016-07-19 10:44:44
阅读次数:
165
一天一道LeetCode
本系列文章已全部上传至我的github,地址:ZeeCoder‘s Github
欢迎大家关注我的新浪微博,我的新浪微博
欢迎转载,转载请注明出处
(一)题目
Given an integer (signed 32 bits), write a function to check whether it is a power of 4.
Exam...
分类:
其他好文 时间:
2016-07-17 00:26:00
阅读次数:
188
nvidia在linux上控制风扇速度有点坑爹,需要起X,这里汇总一下整个流程 1.nvidia-xconfig --enable-all-gpus --separate-x-screens --cool-bits=4 生成xorg.conf 2.在X已启动的前提下,用nvidia-settings ...
分类:
其他好文 时间:
2016-07-15 13:23:33
阅读次数:
1340
Determine the number of bits required to flip if you want to convert integer n to integer m. Notice Both n and m are 32-bit integers. Determine the nu ...
分类:
其他好文 时间:
2016-07-15 06:36:20
阅读次数:
218
1. 问题描述 Given an integer, write a function to determine if it is a power of two.Tags: Math Bit ManipulationSimilar Problems: (E) Number of 1 Bits (E) ...
分类:
其他好文 时间:
2016-07-13 01:27:44
阅读次数:
117