Serialization is the process of converting a data structure or object into a sequence of bits so that it can be stored in a file or memory buffer, or ...
分类:
其他好文 时间:
2016-12-27 07:50:21
阅读次数:
501
https://leetcode.com/problems/counting-bits/ 给定一个非负数n,输出[0,n]区间内所有数的二进制形式中含1的个数 Example: For num = 5 you should return [0,1,1,2,1,2]. 注意fellow up部分,题目 ...
分类:
其他好文 时间:
2016-12-26 14:03:32
阅读次数:
159
The Hamming distance between two integers is the number of positions at which the corresponding bits are different. Given two integers x and y, calcul ...
分类:
其他好文 时间:
2016-12-20 07:34:37
阅读次数:
241
A. Ostap and Grasshopper(water) 题意: 给出一个字符串(n<=100),问从‘G’字符的位置可否每次只可恰好跳步长为k的一步(只可跳到非‘#’字符的位置且不可跳出字符串外),跳若干步到达‘T’字符的位置。 1 #include <bits/stdc++.h> 2 us ...
分类:
其他好文 时间:
2016-12-16 22:00:41
阅读次数:
261
Use Stack, O(N) space Two Pointers, O(1) space i stand for the right-most non-9 bit, where if there's a carry, i is incremented and the bits after i w ...
分类:
其他好文 时间:
2016-12-16 14:53:25
阅读次数:
149
#190. Reverse Bits Reverse bits of a given 32 bits unsigned integer. For example, given input 43261596 (represented in binary as 000000101001010000011 ...
分类:
其他好文 时间:
2016-12-16 07:40:59
阅读次数:
189
A. Vladik and flights(water) 题意:从a位置到b位置去, 问最短花费 想通了就是大水题 1 #include <bits/stdc++.h> 2 using namespace std; 3 const int INF = 0x3f3f3f3f; 4 const int ...
分类:
其他好文 时间:
2016-12-15 14:15:39
阅读次数:
196
338. Counting Bits 原题链接https://leetcode.com/problems/counting-bits/ 自己的思路:Integer.bitCount()方法,但是原题并不推荐使用内嵌方法 bug free:遇到偶数时,其1的个数和该偶数除以2得到的数字的1的个数相同, ...
分类:
其他好文 时间:
2016-12-14 22:07:38
阅读次数:
189
位运算相关 三道题 231. Power of Two 位运算相关 三道题 231. Power of Two Given an integer, write a function to determine if it is a power of two. (Easy) 分析: 数字相关题有的可以考 ...
分类:
其他好文 时间:
2016-12-12 22:52:53
阅读次数:
154
Computer Systems A Programmer's Perspective Second Edition As we will discuss, the extension of IA32 to 64 bits, termed x86-64, was origi- nally devel ...
分类:
数据库 时间:
2016-12-05 14:21:39
阅读次数:
223