Bit
eatbanli
这个作者很懒,什么都没留下…
展开
-
BM191NumberOf1Bits
Pre-defined MethodsInteger.toBinaryString(int n) return binary stringInteger.toBinaryString(int n).toCharArray() directly to array. 思路知道可以用位运算,但是不会应用,参考discussion https://discuss.leetcode.com/top原创 2016-09-17 05:02:44 · 183 阅读 · 0 评论 -
BM CC150 Ch5 BM53
之前的错误思路之后的正确思路原创 2016-09-23 11:56:00 · 395 阅读 · 0 评论 -
BM190ReverseBits
思路Use char array注意If you change the variable on it’s own in the if logic, remember to use else if or it may deal with the changed result rather than original valueFailed case4294967295超出int范围,话说这种原创 2016-09-24 23:06:41 · 146 阅读 · 0 评论 -
BM371SumOfTwoIntegers
Negative bits shouldn't be influenced by bits manipulation原创 2016-11-10 12:45:41 · 234 阅读 · 0 评论 -
BM136SingleNumber
今天编程用了两个之前知道但没实践过的思路。 [ ] 把一个array头尾相接,两个pointer循环,排除数值相同的pairs直到找到single one 头尾相接,如果不用单向链而是修正两个pointers之间的差距,真的很麻烦。能用数据结构的还是先用数据结构吧原创 2016-10-08 11:04:19 · 226 阅读 · 0 评论 -
BM318Maximum Product of Word Lengths
思路1 Brute ForceUse brute force two check every pairs. Has TLE problem思路2 BitI want to use Bit, but bit of a and bit of bb always have common 1s with intersection or xor. I have no idea how to use th原创 2016-11-23 13:00:47 · 250 阅读 · 0 评论